Java Spring 2006 - HW1 FAQ

Click on a question to expand it (for the details).
Click on the question title again to hide the details.

+ CLASSPATH

Question:

I got the compiler to work, but when I try to run my program I get this:

Exception in  java.lang.NoClassDefFoundError: Hw1

What am I doing wrong?


Answer:

The problem is that the Java Virtual Machine can't find the class named Hw1. You can look at the installation documentation for information about setting the CLASSPATH variable. The quick answer is to try this:

java -classpath . Hw1

The above command tells java to add "." to your CLASSPATH. "." represents the current working directory, so now java will look the the current directory.

+ java.vm.name

Question:

I don't get any result for the system property "java.vm.name", should I?


Answer:

I do, but I may be running a different virtual machine than you (I'm running under Linux).

As far as the assignment goes (grading), you won't lose points if your virtual machine doesn't know it's own name... (it's ok if it says "null").