| Author |
Head1stJava - pg 88 - 24 lines of confusion
|
Ioan Sirbu
Greenhorn
Joined: Jan 07, 2005
Posts: 8
|
|
Hello everyone. I am going through the O'Reilly Head First Java. I am trying to do all the exercises provided at the end of the chapters and really gain serious understanding as to what the code is doing rather then typing out and just pluging in different variables. I'm suffering from a few issues that I seem to be blind to. I've checked the OReilly site on the errata confirmed,unconfirmed and revised. I did have the code running however in my effort to see and visualize all the steps it takes I seem to have broken it. I've double checked my code to match what is in the book and can't find the error(s?). I want to understand why I'm getting an exception that states that main is NoClassDefFoundError? Please help. Thank you. Sincerely, Ioan C. Sirbu _____________________
|
 |
Joel McNary
Bartender
Joined: Aug 20, 2001
Posts: 1815
|
|
It seems that you don't necessarily have a problem with the program itself, but rather with the environment in which you are running it. Basically, you are telling the JVM to run the main method in the Mix4 class, and it is reposnding by telling you that it cannot find the Mix4 class. What is the environment you are running in? (The directory structure and command used to run the program are good places to start...after that, check the CLASSPATH)
|
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
|
 |
Jeff Bosch
Ranch Hand
Joined: Jul 30, 2003
Posts: 804
|
|
|
I have no problems compiling and running this code as is. Did you save the source with the same name as the public class, that is Mix4.java?
|
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
|
 |
Ioan Sirbu
Greenhorn
Joined: Jan 07, 2005
Posts: 8
|
|
This would be really weird because I haven't had this issue with my path or classpath env settings... -Ioan _____________ H:\HeadFirstJava\Mix4_88> path PATH=C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;H:\jdk1.5.0_01\bin H:\HeadFirstJava\Mix4_88> java -version java version "1.5.0_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08) Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing) H:\HeadFirstJava\Mix4_88> javac Mix4.java H:\HeadFirstJava\Mix4_88> java Mix4.class Exception in thread "main" java.lang.NoClassDefFoundError: Mix4/class
|
 |
Ioan Sirbu
Greenhorn
Joined: Jan 07, 2005
Posts: 8
|
|
I deleted and recreated the director(ies) and rebuilt the Mix4.java file from scratch... It works fine now... Turns out there was a file open or lock or something somewhere. We can blame Borland and me for having two projects open in JBuilder X.... Thanks guys for getting me and my thinking on on the right track...  [ January 07, 2005: Message edited by: Ioan Sirbu ]
|
 |
 |
|
|
subject: Head1stJava - pg 88 - 24 lines of confusion
|
|
|