Win a copy of Rust Web Development this week in the Other Languages forum!

Francesca Gibbons

Greenhorn
+ Follow
since Jul 30, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Francesca Gibbons

For code see:
http://java.sun.com/docs/books/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java

my .java file is in c:\jdk\bin
my .class file is in c:\jdk\bin

javac HelloWorldSwing.java

runs with no errors (jse 1.6.0.07)

java HelloWorldSwing

generates NoClassDefFoundError

I fail to understand why this is generated when the files are in the current directory. I've tried set CLASSPATH=C:\jdk\bin and then running java but i obtain the same result. I am positive this is not a typo. I had this problem many years ago when i first started Java, but haven't used it in years and am starting it up again. What am I missing? I've looked through the forum and the only think i haven't done is set a classpath environment which I dont (and others) think is necessary.

*****************************************
Thanks for your explanations. I created a start folder in the root. I could not run javac from anywhere but c:\jdk\bin.

Running javac c:\start\HelloWorldSwing.java in c:\start created the 2 class files.

Typing java start.HelloWorldSwing from bin folder still generated same error. java HelloWorldSwing generated same thing. java -classpath c:\start HelloWorldSwing also failed.

This seems so silly. Why does javac respond so easily to a directory path while java seems to be so clueless (like me).

**************************************
Commenting out the package start; line allows the command

java -classpath c:\start HelloWorldSwing

to work. Thanks again for your assistance.
[ July 30, 2008: Message edited by: Francesca Gibbons ]
[ July 30, 2008: Message edited by: Francesca Gibbons ]
13 years ago