Exception in thread "main" java.lang.NoClassDefFou

Need help with C, C++, perl, python, etc?

Exception in thread "main" java.lang.NoClassDefFou

Postby awfulman » 2007-01-04 05:03

Does anybody know? I am learning Java.
I have JDK TM 6 installed in directory /home/rex/Programs/jdk1.6.0
I compiled HelloWorldApp.java without problems by the command
Code: Select all
:~$ /home/rex/Programs/jdk1.6.0/bin/javac /home/rex/del/HelloWorldApp.java
But I cannot test HelloWorldApp.class.
When I enter command
Code: Select all
:~$ /home/rex/Programs/jdk1.6.0/jre/bin/java /home/rex/del/HelloWorldApp
it says:
Exception in thread "main" java.lang.NoClassDefFoundError: /home/rex/del/HelloWorldApp
What I am doing wrong?
awfulman
 
Posts: 195
Joined: 2006-12-02 04:31

Postby awfulman » 2007-01-04 23:32

If somebody is interested, I know how to fix.

I put the following lines into my .bash_profile
Code: Select all
#!/bin/bash
           
JAVA_HOME=/home/rex/Programs/jdk1.6.0
JAVA_FONTS=/usr/share/fonts/truetype
ANT_HOME=/usr/share/ant
                       
PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH
                                       
export PATH JAVA_HOME JAVA_FONTS ANT_HOME
export CLASSPATH=$CLASSPATH:.


Though you can get the same error, if you don't change your current directory to the one where your *.class resides. Due to some reason java can't find your file. See troubleshooting issues:
https://java.sun.com/docs/books/tutoria ... index.html

What is the correct code for the applets? My firefox doesn't want to show them.
awfulman
 
Posts: 195
Joined: 2006-12-02 04:31


Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable