Showing posts with label Class Path. Show all posts
Showing posts with label Class Path. Show all posts

Solution for Unable to find a javac compiler error in Jboss 4.0 with Eclipse when running JSP file

When you run a JSP with JBoss Application server in eclipse IDE , the following error may occur "org.apache.jasper.JasperException: Unable to compile class for JSP"

JBoss appserver throws the following error
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 reason for the above error is "com.sun.tools.javac.Main" class which is bundled with tools.jar, is not in the class path . So we need to include the tools.jar file in the class path. When we add the jre to the build path , it includes all necessary jar files except tools.jar in the class path . Assume that jdk1.6.0_23 is installed in d:\ . jdk1.6.0_23 can be downloaded from java site.
tools.jar file will be located in the installed folder of jdk (i.e d:\jdk1.6.0_23\lib OR d:\ jdk1.6.0_23\jre\lib)

Steps to include the tools.jar file in the classpath in eclipse
1. Select Windows->Preferences ->Java -> Installed JRE
2. Highlight the selected jre and click in edit buttor as shown in the following screen shot

3. Click on Add External Jars and select the tools.jar file from the jdk\lib OR jdk\jre\lib folder then Finish.

Now you will be able to run the JSP file.


Read more...

 
Copyright 2011 Java Online