Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I run a jar file I created, I get the following error, so please someone help me out of this:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: img/black_ring.png at at at at at at at com.badlogic.runningball.UserBall.( at com.badlogic.runningball.GameScreen.( at com.badlogic.runningball.RunningBall.create( at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop( at com.badlogic.gdx.backends.lwjgl.LwjglApplication$ Caused by: com.badlogic.gdx.utils.GdxRuntimeException: File not found: img/black_ring.png (Internal) at at com.badlogic.gdx.files.FileHandle.length( at com.badlogic.gdx.files.FileHandle.readBytes( at ... 10 more

share|improve this question

closed as off-topic by Anko, MrCranky, Jari Komppa, Byte56 May 4 '14 at 15:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Anko, MrCranky, Jari Komppa, Byte56
If this question can be reworded to fit the rules in the help center, please edit the question.

If you don't even write the command line you used... – o0'. Apr 5 '12 at 8:44
1 could be a better place to put this kind of question, I think... – NemoStein Apr 5 '12 at 13:16

The problem in this case is that the file img/black_ring.png is missing from the JAR-file. You need to add it, else the application can't start. Any application able to handle a JAR file as ZIP archive enables you to do so.

For a description on how you create a fitting file directly your question contains far to less information. Information like how you created this JAR file in the first place and the IDE and/or buildsystem you used are essential to get a good answer.

share|improve this answer
I am using eclipse IDE to create the jar file and I found that error so provide guidance – Siddharth Apr 6 '12 at 5:12
At jar file creation time I found an error – Siddharth Apr 6 '12 at 5:23

Use the program 7zip, or, on if you are on a Unix system it should have tar installed, which is what a Jar is: a Java tar.

I'm not sure what your development environment is, but you seem to be lacking the fundamental knowledge of how an executable jar works.

For a jar to be executable, it needs a manifest file. This file tells java what your main class file is, i.e:

Manifest-Version: 1.0
Main-Class: package.names.MainClass

I see you are also using LWJGL. To use that, you will also need to specify the classpath variable in the manifest, so it will now look like this:

Manifest-Version: 1.0
Main-Class: package.names.MainClass
Class-Path: lwjgl.jar

This assumes that lwjgl.jar will be in the same folder as your executable jar. IIRC lwjgl also requires native libraries, so you will have to set that as an argument to the Java VM, try this:

Edit: Just realized I forgot to say how to actually create the jar!

To create the jar file, you use the jar command:

jar cvfm output.jar manifest *.class

For finding all the class files, on Linux I use this handy command

find . -iname '*.class' | sed 's:\./::' > filelist

to get all the class files in all the subdirectories of your current location and output them into the file 'filelist'.

(I'm sure there is an easier way, but that's how I do it)

then you can use the command

jar cvfm output.jar manifest @filelist

without worrying about having to recurse into subdirectories looking for classes

share|improve this answer

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