Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Exception in thread "main" java.lang.NoClassDefFou

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
awfulman
Posts: 195
Joined: 2006-12-02 04:31

Exception in thread "main" java.lang.NoClassDefFou

#1 Post by awfulman »

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

#2 Post by awfulman »

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.

Post Reply