This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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