This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes exception found, cant find driven class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "exception found, cant find driven class" Watch "exception found, cant find driven class" New topic
Author

exception found, cant find driven class

Ben Hultin
Ranch Hand

Joined: Aug 17, 2009
Posts: 135
I have compiled my program and recieved this error:



G:\Documents and Settings\ben\Desktop\Desktop\Desktop\Ben\park>java GreedGame
Exception in thread "main" java.lang.NoClassDefFoundError: Greed
at GreedGame.main(GreedGame.java:10)
Caused by: java.lang.ClassNotFoundException: Greed
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 1 more





my diver class begins as so:




my driven class is as so:



There are a number of methods inside the Greed class, but I doubt they part of the problem. I have both java files in the same directory/folder and never had problem with past compiles. been getting errors refering to the driven file that is now "unknown"

I appreciate any help in the matter.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

The JVM does not find your Greed class, which means that the CLASSPATH is not correctly set. It looks like you're using the default package (which you should avoid), so try to add the current directory to the CLASSPATH: java -cp . GreedGame


[My Blog]
All roads lead to JavaRanch
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 41096
    
  29
If you set a system classpath yourself, you might do well to delete it. If a system classpath has been set for you by another application, try editing that by adding .; to its beginning (for DOS/Windows, for other Operating Systems ..
 
rocket mass heater kickstarter
 
subject: exception found, cant find driven class