View Full Version : Problem adding jar to class path
Black Mage
September 29th, 2007, 03:36 PM
I have a jar called BDJ.jar in my home directory and I tried to add it to the classpath by doing
java -classpath ~/workspace/BluRay/ BDJ.jar
But it seems its not reading it because it throws
Exception in thread "main" java.lang.NoClassDefFoundError: BDJ/jar
So how else am I suppose to add a jar to the class path in the command line?
Fixman
September 29th, 2007, 03:46 PM
I have a jar called BDJ.jar in my home directory and I tried to add it to the classpath by doing
java -classpath ~/workspace/BluRay/ BDJ.jar
But it seems its not reading it because it throws
Exception in thread "main" java.lang.NoClassDefFoundError: BDJ/jar
So how else am I suppose to add a jar to the class path in the command line?
Try
java -classpath $HOME/workspace/BluRay/BDJ.jar
Black Mage
September 29th, 2007, 04:25 PM
No, it still throws the same error, and the jar is in that directory. Here is the full command line:
john@ubuntu:~/workspace/BluRay$ java -classpath $Home/workspace/BluRay/ BDJ.jar
and then I tried
john@ubuntu:~/workspace/BluRay$ java -classpath $John/workspace/BluRay/ BDJ.jar
and a few other variations wihth no success.....any ideas?
Ramses de Norre
September 29th, 2007, 04:48 PM
Delete the space between the "/" and the filename, so instead of "$Home/workspace/BluRay/ BDJ.jar" you type "$HOME/workspace/BluRay/BDJ.jar".
I've also change "$Home" to "$HOME" because only the latter exists (unless you manually defined the lowercase one).
The command line is picky on spaces and cases...
Black Mage
September 29th, 2007, 05:12 PM
Ahhhh, thnx is compiles now using
javac -classpath $HOME/workspace/BluRay/BDJ.jar MySecondXlet.java
but still no success getting the Xlet to actually run, exception because of no main method.
But thnx, thats problem down.
lamadredelsapo
October 1st, 2007, 01:06 PM
next time add it to the .bashrc file, so you won't have to edit classpath whenever you want to use that jar
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.