问题描述
我尝试学习 LibGDX,我安装了列出的所有软件 这里在新格式化的 mac OS X Maverick 上使用新的 Eclipse 4.3.
I trying to learn LibGDX, I install all the software listed here with a new Eclipse 4.3 on a fresh formatted mac OS X Maverick.
一切顺利,重新启动后,我下载并执行 gdx-setup.jar,填写表格,然后导入 Eclipse.
Everything goes smooth, after a reboot, I download, and execute the gdx-setup.jar, fill the form, and import into Eclipse.
当我尝试运行桌面时,没有错误,没有警告.(右键桌面项目,Run As -> Java Application).
No error, no warning, when I try to run the desktop. (Right click the desktop project, Run As -> Java Application).
我收到了这个错误
我在这里发现了很多类似的问题,我都尝试了,但没有任何好的结果...昨晚我发现了 这个,很酷,我有最新的 Java 1.8,一个 mac,和 Eclipse 完美契合...
I found a lot of similar issue here, I try them all without any good result... Last night I found this, very cool I have the latest Java 1.8, a mac, and Eclipse fit perfectly...
但没有成功,我尝试使用 Java 1.6 和 1.7,总是同样的错误(未找到文件,我保留 Java 1.7)
But no success, I try with Java 1.6 and 1.7, Always the same error (No file found, I kept Java 1.7)
我开始做一些debug,这里我只修改导入生成的原始代码.
I begin to do some debug, here my only modification of the original code generated by the importation.
奇怪的是 pathLocal 等于 "".Gdx.files.getLocalStoragePath() 什么都不返回(空字符串)正常吗?
The weird thing is pathLocal is equal to "". Is it normal for Gdx.files.getLocalStoragePath() to return nothing (empty string)?
还有
效果很好.只有本地的会报错,isLocal也是,isExternal返回true.
Works great. only the local one gives the error, also isLocal, and isExternal return true.
我尝试了很多组合,例如 /assets/data/badlogic.jpg
、/assets/badlogic.jpg
、/data/badlogic.jpg
、data/badlogic.jpg
和 badlogic.jpg
.
And I try a lots of combinations, like /assets/data/badlogic.jpg
, /assets/badlogic.jpg
, /data/badlogic.jpg
, data/badlogic.jpg
, and badlogic.jpg
.
图片 badlogic.jpg 在那里,我把它放在多个地方确定.
The image badlogic.jpg is there and I put it in multiple places to be sure.
现在我在这里寻求帮助的原因是我只是在 PC 上尝试所有相同的步骤,一切都很好.
And now the reason why I'm here for help is I just try all the same step on a PC and everything works great.
我的新 Mac 及其设置有什么问题?
What is wrong with my new mac and it's setting?
推荐答案
来自 libgdx wiki
From libgdx wiki
当您运行桌面项目时
应用程序将在第一次失败.打开刚刚创建的运行配置,将工作目录设置为android/assets/目录!
The application will fail the first time. Open the Run Configuration you just created and set the working directory to the android/assets/ directory!
将您的桌面项目链接到 android assets 文件夹?
link your desktop project to android assets folder?
转到 Run => Run Configurations.. => 选择 DesktopLauncher,Arguments Tab => Working Directory => Others 然后浏览到yourproject-android/assets/并点击 Apply => Run
Go to Run => Run Configurations.. => choose DesktopLauncher, Arguments Tab => Working Directory => Others then browse to yourproject-android/assets/ and click Apply => Run
这篇关于“找不到文件"运行新的 LibGDX 项目时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!