File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error :Unable to find a javac compiler

 
Phillipe Rodrigues
Ranch Hand
Posts: 165
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I get the following error when i try executing my web application.

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK


The follwing is installed:
j2sdk1.4.2_06,Tomcat 5.0.28
OS-winxp sp2

Advanced->Environmental Variables->User Variables->
JAVA_HOME=C:\j2sdk1.4.2_06;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
Classpath=C:\j2sdk1.4.2_06\lib\tools.jar

Advanced->Environmental Variables->System Variables->
Path=C:\j2sdk1.4.2_06\bin

Request your help.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JAVA_HOME=C:\j2sdk1.4.2_06;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar

Why you included C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar

use JAVA_HOME=C:\j2sdk1.4.2_06

Include C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar in classpath
[ August 29, 2008: Message edited by: Pratap koritala ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And why are you using packages beginning com.sun? You will have to check, but there is a risk that packages beginning com are experimental and might be removed in later releases of Java.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Phillipe Rodrigues:
Advanced->Environmental Variables->User Variables->
JAVA_HOME=C:\j2sdk1.4.2_06;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar
Classpath=C:\j2sdk1.4.2_06\lib\tools.jar

Advanced->Environmental Variables->System Variables->
Path=C:\j2sdk1.4.2_06\bin

Your JAVA_HOME is wrong; it should be set only to C:\j2sdk1.4.2_06. Remove the reference to the Tomcat servlet-api.jar from your JAVA_HOME.

Your CLASSPATH is also strange. You do not need to add tools.jar to the CLASSPATH. It's best to leave the CLASSPATH variable not set (delete it).

Your PATH setting is correct.
Originally posted by Campbell Ritchie:
And why are you using packages beginning com.sun? You will have to check, but there is a risk that packages beginning com are experimental and might be removed in later releases of Java.

Campell, Philippe most likely is not using the Sun packages himself. The Java compiler itself is written in Java and the package that the error refers to is the package where the compiler is implemented.
[ August 29, 2008: Message edited by: Jesper Young ]
 
Campbell Ritchie
Sheriff
Pie
Posts: 47300
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jesper Young:

Campell, Philippe most likely is not using the Sun packages himself. The Java compiler itself is written in Java and the package that the error refers to is the package where the compiler is implemented.
That's all right then.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic