Reputation: 1281
I have the following folder structure:
My workspace is /java and the "project" is like this:
- de
- vfh
- gp1
- bib
- Console.class
- Console.java
- app
- MyFile.java
- MyFile.class
So when I do:
cd ~/Desktop/java
javac -classpath "." de/vfh/gp1/app/MyFile.java
cd ~/Desktop/java/de/vfg/app/
java MyFile
The javac command works well but the java command fails and I get:
java.lang.NoClassDefFoundError: de/vfh/gp1/bib/Console
Any ideas how my classpath should look like?
Upvotes: 0
Views: 525
Reputation: 12953
you should run it from the root of your project, and use the full name (with package) of the class:
cd ~/Desktop/java/
java de.vfg.app.MyFile
BTW - I don't see you compile Console
, this is obviously needed
Upvotes: 2