I am getting the error
Exception in thread "main" java.lang.NoClassDefFoundError:
When I try and run a compiled class on Ubuntu. I am using a very simple Helloworld example, and the millions of responses which already exist on the internet suggest that my CLASSPATH and JAVA_HOME variables have been incorrectly set.
However, I have edited the etc/environment to the correct folders as well as the current folder:
PATH=".:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
JAVA_HOME="/usr/lib/jvm/java-1.5.0-sun/"
CLASSPATH=".:/usr/lib/jvm/java-1.5.0-sun/lib"
and they appear when I type the set command. In any case, even when I set the classpath manually using
sudo java -cp . myfirstjavaprog.class
I get the same error. Where else should I look? This must be a configuration problem.
Many thanks