title: Setting up java classpath and java_home correctly in Ubuntu
body: <p>I am getting the error</p>
  <blockquote>
  <p>Exception in thread &quot;main&quot; java.lang.NoClassDefFoundError:</p>
  </blockquote>
  <p>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.</p>
  <p>However, I have edited the etc/environment to the correct folders as well as the current folder:</p>
  <blockquote>
  <p>PATH=&quot;.:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games&quot;</p>
  <p>JAVA_HOME=&quot;/usr/lib/jvm/java-1.5.0-sun/&quot;</p>
  <p>CLASSPATH=&quot;.:/usr/lib/jvm/java-1.5.0-sun/lib&quot;</p>
  </blockquote>
  <p>and they appear when I type the set command.  In any case, even when I set the classpath manually using</p>
  <blockquote>
  <p>sudo java -cp . myfirstjavaprog.class</p>
  </blockquote>
  <p>I get the same error.  Where else should I look?  This must be a configuration problem.</p>
  <p>Many thanks</p>