I know there are many posts concerning NoClassDefFoundError, they all seem to be talking about jar files. While I'm comfortable with java in eclipse, I'm pretty lost as to why the simplest thing I can come up with is not functioning, unless they broke something on the university side of this.
public class hello {
public static void main (String args[]) {
System.out.println ("Hello World!");
}
}
This is the entire hello.java program which throws this:
Exception in thread "main" java.lang.NoClassDefFoundError: hello/java
Caused by: java.lang.ClassNotFoundException: hello.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: hello.java. Program will exit.
$CLASSPATH=./:/usr/java/latest/lib:/home/41/myusername/bin
java -verbose hello.class
gives:
[Opened /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.Object from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.io.Serializable from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.Comparable from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.CharSequence from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.String from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.reflect.GenericDeclaration from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.reflect.Type from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.reflect.AnnotatedElement from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] [Loaded java.lang.Class from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] ... [Loaded sun.misc.AtomicLong from /usr/java/jdk1.6.0_10/jre/lib/rt.jar] ...
with the exception again.
java -version
gives:
java version "1.6.0_10-rc2" Java(TM) SE Runtime Environment (build 1.6.0_10-rc2-b32) Java HotSpot(TM) Server VM (build 11.0-b15, mixed mode)