i am using Apache Tomcat Version 5.0.28 but it is not working well i have just typed a simple code and it is giving error .i am providing error and also code please giude me where is the problem , i am new to jsp please help me thanx.
.jsp file contains following code:
/code

<%@ page language="java" %>
<% String s1="",s2="";

s1=request.getParameter("T1");

s2=request.getParameter("T2");

%>

<%= s1 %>
<%= s2 %>
/code

and .html file contains
/code
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="50%">
<form method="POST" action="ja.jsp">
<!--webbot bot="SaveResults" U-File="file:///D:/Documents and Settings/WAQAR/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>&nbsp;</p>
<p>username</p>

<p>&nbsp;</td>
<td width="50%"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="50%">password</td>
<td width="50%"><input type="password" name="T2" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>

</body>
</form>

</html>

/code

and the following error is displayed by tomcat when i used to run it plz help me.

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

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
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

yes i have installed javabut and it is working properly .now wat can b done. please help me to solve this problem

Unable to find a javac compiler;
Perhaps JAVA_HOME does not point to the JDK

Do you have JDK installed too? Make sure you let tomcat know where your java compiler is located.

This problem occurs when at the time of installation of Tomcat you make it point to JRE instead of JDK. Reinstall Tomcat and when it asks for Java path, provide it the path to your JDK instead of the default JRE which appears there.

remove this and check again


<!--webbot bot="SaveResults" U-File="file:///D:/Documents and Settings/WAQAR/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" -->

Hi, You first make sure that all the paths are set correctly. most important all the jar files for Jsp and servlet should be at right place that will make you JSP compiler to work.

i am using Apache Tomcat Version 5.0.28 but it is not working well i have just typed a simple code and it is giving error .i am providing error and also code please giude me where is the problem , i am new to jsp please help me thanx.
.jsp file contains following code:
/code

<%@ page language="java" %>
<% String s1="",s2="";

s1=request.getParameter("T1");

s2=request.getParameter("T2");

%>

<%= s1 %>
<%= s2 %>
/code

and .html file contains
/code
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="50%">
<form method="POST" action="ja.jsp">
<!--webbot bot="SaveResults" U-File="file:///D:/Documents and Settings/WAQAR/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><p>&nbsp;</p>
<p>username</p>

<p>&nbsp;</td>
<td width="50%"><input type="text" name="T1" size="20"></td>
</tr>
<tr>
<td width="50%">password</td>
<td width="50%"><input type="password" name="T2" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>

</body>
</form>

</html>

/code

and the following error is displayed by tomcat when i used to run it plz help me.

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

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
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.28

Hi, You first make sure that all the paths are set correctly. most important all the jar files for Jsp and servlet should be at right place that will make you JSP compiler to work.


I think that answer was already given, don't you???

This problem occurs when at the time of installation of Tomcat you make it point to JRE instead of JDK. Reinstall Tomcat and when it asks for Java path, provide it the path to your JDK instead of the default JRE which appears there.

This article has been dead for over six months. Start a new discussion instead.