I'm trying to use libgdx to set up a little quiz application for Desktop.

So I used the setup.jar to create a project and everything went fine (using Eclipse).

The problem is following:

Whenever I try to access the assets in core/assets, as you should do: Gdx.files.internal(filePath)

I always get a NullPointerException:

java.io.FileNotFoundException: PATH\QuizApplication\desktop\questions.xml (The system cannot find the file specified)

My assets Folder in the desktop project is linked to the core project, and inside Eclipse, I can see the right contents. As you can see from the Exception, the application tries to read the desktop project instead of the core project.

In build.gradle in the desktop project, the link to the core assets folder is there too:

project.ext.assetsDir = new File("../core/assets");

Does anyone know how I might fix this problem, so that I can access the core/assets folder?

  • \$\begingroup\$ You probably need to set your working directory to the assets folder. Read this answer: stackoverflow.com/questions/26195511/… \$\endgroup\$ – Gad Wissberg Apr 18 '18 at 8:56
  • \$\begingroup\$ Thanks,that fixxed it! Now I'm having other problems concerning packaging the Application with gradlew. I guess I'll start from scratch and test everything step by step to see where I made a mistake. \$\endgroup\$ – Wyatt Gilette Apr 19 '18 at 16:02
  • \$\begingroup\$ If you found a solution to own question, you can post an answer yourself. \$\endgroup\$ – wondra Apr 19 '18 at 19:16

I could fix the problem by using these two questions:



I guess the gdx-setup.jar does everything for you except directing the Workspace the right way.

My second problem in the comments could be fixxed by using a lower Java JDK (1.8.0_151).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.