|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
Can 't get Java class run!Help
I 'ma newbie in JAVA
Below is the source file named 'HelloJava.java'
It passed compiling, however it can 't be run by command' java HelloJava '
And error message 'Exception in thread "main" java.lang.NoClassDefFoundError : HelloJava' was printed!
What on earth is the problem??Does it have any connection with the 'jre'?
I install j2sdk1.4.2_02 from a rpm package, and my system is' RedHat 8.0 '.
13X
PS.
I add some new lines in /etc/profile
JAVA_HOME=/usr/java/j2sdk1.4.1_01
CLASSPATH=. : $JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/jre/lib
PATH=$JAVA_HOME/bin:$PATH
Export PATH JAVA_HOME CLASSPATH
Import java.util.*;
Import java.lang.*;
(Public static class HelloJava
Public void main (String args [])
{
System.out.println ( "The time now is :");
System.out.println (new Date ());
}
} |
Can 't get Java class run!Help
Import java.util.*;
Import java.lang.*. "=can Be deleted, upload default by the compiler
Public class HelloJava --
Public static void main (String args [])
{
System.out.println ( "The time now is :");
System.out.println (new Date ());
}
} |
| |