Forums Register Login

Problems with jr.jar even though compile runs. Assignment OOP-1 DaysOld.java

+Pie Number of slices to send: Send
I am working on MAC OSX leopard 10.5.8. I am on OOP-1. I can compile my class but when I try and run it I get an error.


macbook:java mmg$ javac -classpath /Users/mmg/java/jr.jar /Users/mmg/java/DaysOld.java
macbook:java mmg$ java DaysOld 2009-1-1
Exception in thread "main" java.lang.NoClassDefFoundError: com/javaranch/common/GDate



This is my version information.

macbook:~ mmg$ java -version
java version "1.5.0_19"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_19-b02-304)
Java HotSpot(TM) Client VM (build 1.5.0_19-137, mixed mode, sharing)



I found another post in the cattle drive forum (2001/08/20) and it seems the person had a bad .zip file of the javaranch class. They re-downloaded and the problem was resolved. I have re-downloaded the jr.jar and no change.

Any suggestions welcome.
+Pie Number of slices to send: Send
If you are including the jar file at compile time, then include it at runtime too. try


[I've never used machintosh so I don't know what the path separator on it is, I've written ; which is used on windows]
+Pie Number of slices to send: Send
The path separator on a Mac is probably : like on Unix.
+Pie Number of slices to send: Send
 

Campbell Ritchie wrote:The path separator on a Mac is probably : like on Unix.


Correct.

I ran a simple test just to show I am running the same versions and to show the classpath in use on my Mac:

As you can see from lines 2 & 4, I am using the same versions of OS/X and Java. Specifying the classpath when running the java command allowed me to include the jar file. Note the period (.) that is explicitly named in the classpath so that I can ensure that I have the current working directory included when running my program.
+Pie Number of slices to send: Send
Yes it had to be a : not a ;

This worked.

java -classpath /Users/mmg/java/jr.jar:. DaysOld 2009-1-1



Thanks for the help.
Well don't expect me to do the dishes! This ad has been cleaned for your convenience:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1868 times.
Similar Threads
java command not finding jar file
Classpath problem (probably typical)
Problems with OOP-1 ...
OOP1 Classpath issue
catlle drive oop-1 to 4
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 22:53:55.