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;
tshepang
  • 12,111
  • 21
  • 91
  • 136
Tomato
  • 336
  • 5
  • 19

1 Answers1

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

Reimeus
  • 158,255
  • 15
  • 216
  • 276
  • 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 01 '13 at 08: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 01 '13 at 08:37
  • So i opened a new post and the people at stackoverflow solved it [HERE](http://stackoverflow.com/questions/17989345/java-lang-unsatisfiedlinkerror-no-lwjgl-in-java-libary-path-at-java-run) – Tomato Aug 01 '13 at 09:20