0

Hey I got this problem when running a java program through my cmd.

I use to external libraries : lwjgl.jar and slick-util.jar

when I compile

javac -d bin -sourcepath src -cp ;lib/lwjgl.jar;lib/slick-util.jar src/*.java

everything works fine

but when I try to run it

java -cp bin .;lib/lwjgl.jar;lib/slick-util.jar; Game

I get this error

Error: could not find or load main class .;lib.lwjgl.jar;lib.slick-util.jar;

1 Answer 1

0

Replace the space in the run command classpath with a classpath separator

java -cp bin;.;lib/lwjgl.jar;lib/slick-util.jar; Game
            ^

as an improvement to the run command you could use a classpath wilcards, for example

java -cp ".;bin;lib/*" Game

It is important to use quotes under Windows for this option

3
  • Okay I added the ";" so it's looks like yours above but now i get the following error Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path ...
    – Tomato
    Aug 1, 2013 at 8:33
  • That's a different error where the the LD_LIBRARY_PATH needs to be set for lwjgl. However that is for another post.The JVM is now finding the Game class.
    – Reimeus
    Aug 1, 2013 at 8:37
  • So i opened a new post and the people at stackoverflow solved it HERE
    – Tomato
    Aug 1, 2013 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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