I'm trying to learn Java 2 on Linux. I have installed jdk-1.3.1_02 Now when give the command
$javac Example.java
it gives me following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Please help.
1.at first check that java is properly installed in the machine.
2.check the path settings
3.check the filename, filename=classname
4."main"is defined correctly.
--------------------------------- Do You Yahoo!? Send FREE video emails in Yahoo! Mail.
On Sun, 20 Jan 2002, Nikhil Joshi wrote:
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
It seems you haven't set ur CLASSPATH environment variable properly.The CLASSPATH environment variable tells the Java Virtual Machine and other Java applications (for example, the Java tools located in the jdk1.3.x\bin directory) where to find the class libraries. you can set ur classpath using set command. You should set classpath to ur_jdk_directory_path/lib/tools.jar;ur_jdk_directory_path/jre/lib/rt.jar.
-Dharmesh
Sometime yesterday, Nikhil Joshi wrote:
$javac Example.java
it gives me following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/tools/javac/Main
Your JDK is not installed properly. The com.sun.tools.javac.Main class needs to be in your classpath. Check the javac script. Check your $CLASSPATH variable. Include dt.jar (I think) in your classpath or pass it on the command line to javac OR unset your $CLASSPATH variable (default will be used).
Check out the FAQs on Sun's java page.
Manish
PS: This is my classpath, compare: .:/usr/local/jdk1.2.2/lib:/usr/local/jdk1.2.2/include