• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems using GDate and JDate

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.* ?

 
Greg Harris
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oops! sorry, marilyn... i thought it was a given because anyone can get that from the documentation.
 
Don Gardner
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic