I am a total beginner with Java, currently working my way through the Head First Java 2nd Edtn book. I have made a DotComBust game (as part of the book) which compiles and runs fine on my PC. But when I try to run the class file using Terminal on my Mac (Leopard 10.5.5), I get the following error msg:
Exception in thread "main" java.lang.NoClassDefFoundError:
I have tried re-compiling the java file using Terminal on my Mac and it does this fine. It just won't run the class file! I was advised to start using something other than Terminal/ TextEdit to work with Java (BlueJ) as this would be easier (the class file runs fine in BlueJ), but the Head First book wants me to learn with TextEdit and Terminal. If anyone can advise me what to do, I would be most grateful.
Then it should find any classes within the current directory. (It's possible that the CLASSPATH environment variable is set, which complicates things. It's better to do without it, specifying the classpath as part of the "java" command.)