I've downloaded JavaRanceCommon.zip, and added it's location to the classpath of my IDE. The program compiles without any errors, but when I try to run the program, I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: com/javaranch/common/GDate at DaysOld.main(DaysOld.java:18) I get the same error with JDate if I comment out the block of code with GDate. I know that my mistake has got to be something stupid, but I'm not having any luck spotting it. Can anyone give me any suggestions? Thanks for the help.
Originally posted by Don Gardner: I've downloaded JavaRanceCommon.zip, and added it's location to the classpath of my IDE. The program compiles without any errors, but when I try to run the program, I get the following error:
First of all, the name above is spelled wrong. Usually the java.lang.NoClassDefFoundError is encountered when there is something wrong with the classpath. What does your classpath look like now? Did you import com.javaranch.common.* ?
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Apr 12, 2001
oops! sorry, marilyn... i thought it was a given because anyone can get that from the documentation.
Joined: Oct 09, 2001
Oops! Sorry about the typo. I did download JavaRanchCommon.zip, and I've added it to my classpath. I am using JCreator, so I created a DaysOld project, then added JavaRanchCommon.zip to the required libraries for the project. My classpath is as follows: C:\My Documents\JavaPrograms\DaysOld\classes;C:\My Documents\JavaPrograms\JavaRanchCommon.zip;C:\Program Files\JavaSoft\jdk1.3.0_02\jre\lib\rt.jar;C:\Program Files\JavaSoft\jdk1.3.0_02\jre\lib\i18n.jar;C:\Program Files\JavaSoft\jdk1.3.0_02\lib\dt.jar;C:\Program Files\JavaSoft\jdk1.3.0_02\lib\tools.jar I do have "import com.javaranch.common.*;" at the beginning of my code, and the program compiles fine, or at least the compiler doesn't give any errors. However, when I type "java DaysOld 2000-2-1" at the command line, I get the error I mentioned previously. Thank you for the help, Don Gardner
Marilyn de Queiroz
Joined: Jul 22, 2000
I ran into a similar problem once. Turned out that the problem was that I had a corrupted JavaRanchCommon.zip file. The current file is 164,716 bytes (found by using the 'dir' command in a DOS prompt window). Your classpath looks like it should work. How about trying to download JavaRanchCommon.zip again.
[This message has been edited by Marilyn deQueiroz (edited September 02, 2001).]
Joined: Oct 09, 2001
Yep, that fixed it. I must have had a corrupted JavaRanchCommon.zip because downloading it again fixed it. Thank you greatly for your help, Don