| Author |
Exception in thread "main" java.lang.NoClassDefFoundError: dice (wrong name: Dice)
|
Raine RaineAndrews
Greenhorn
Joined: Jun 27, 2010
Posts: 9
|
|
First of all, hello! I'm currently on a path of java enlightenment. I am attempting to learn Java by doing, which I feel fits my learning style excellently!
The only problem is I get lots of errors and warning, and while most I can fix, some I cannot figure out. I am currently working on a piece of code that will allow me to see the result of 2 dice being thrown, both their single values and their summation.
when I compile this, I get not warnings or errors, so I'm assuming the syntax is right. However, when I attempt to run this program (through cmd) I get this doozy:
Exception in thread "main" java.lang.NoClassDefFoundError: dice (wrong name: Dice)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.define.ClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassloader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
...it goes on for about 7 more lines of stuff I don't understand and then ends with
Could not find the main class: dice. Program will exit.
So, I searched the forums found something with a similar error, but their problem was not having a main() function. I'm fairly certain the "public static void main(String[] args)" is my main () function. The error itself led me to believe I had forgotten to define this program as a Class, but its clearly labeled as Dice.
Any help you could give to point me in the right path is much appreciated! I am very new with java, so please bear through my ignorance
|
 |
Mike Simmons
Ranch Hand
Joined: Mar 05, 2008
Posts: 2817
|
|
|
How are you running the program? My guess is you're typing "java dice" when you should be typing "java Dice".
|
 |
Raine RaineAndrews
Greenhorn
Joined: Jun 27, 2010
Posts: 9
|
|
|
Thank you very much for pointing out my amateur move! It works perfectly now (besides the whole decimal thing, but I think changing the variables to int, instead of double will fix that!)
|
 |
 |
|
|
subject: Exception in thread "main" java.lang.NoClassDefFoundError: dice (wrong name: Dice)
|
|
|