aspose file tools*
The moose likes Cattle Drive and the fly likes Problems using GDate and JDate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Problems using GDate and JDate" Watch "Problems using GDate and JDate" New topic
Author

Problems using GDate and JDate

Don Gardner
Greenhorn

Joined: Oct 09, 2001
Posts: 25
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.
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
well, since i do not know what your code looks like, i am going to post this:

sorry, no code postings allowed here. Pseudocode or snippets only.

this is how you can use the 2 classes together... i hope this helps.
[This message has been edited by Marilyn deQueiroz (edited August 30, 2001).]


what?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
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:

Exception in thread "main" java.lang.NoClassDefFoundError: com/javaranch/common/GDate
at DaysOld.main(DaysOld.java:18)

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
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
oops! sorry, marilyn... i thought it was a given because anyone can get that from the documentation.
Don Gardner
Greenhorn

Joined: Oct 09, 2001
Posts: 25
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
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
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).]
Don Gardner
Greenhorn

Joined: Oct 09, 2001
Posts: 25
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problems using GDate and JDate