This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply 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: 14672
    
  11

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: 32654
    
    4
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 ..
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: exception found, cant find driven class
 
Similar Threads
calling a method w/out an object
Trying to run my first program: java.lang.NoClassDefFoundError
Basic package question
Fresh SDK Install Won't Compile?
Issues with cmd java command