Big Moose Saloon
 Search | Java FAQ | Recent Topics Register / Login

new to jsp----a small problem about jsp compile

huanyu zhao
Greenhorn

Joined: Feb 22, 2001
Posts: 29
Hello everyone. I'm new to using JSP and just picked up the book "Beginning JSP 2-From Novice to Professional" the other day. I'm trying to run the first jsp examples, but I keep getting an exception error:

I checked to make sure that my JAVA_HOME environment variable is pointing to my SDK directory, it is. And Tomcat is already installed, and I can view the main page, by going to localhost:8080.
I'm not sure what else to check. So, if some kind frined could point me in the right direction, I'd greatly appreciate it.

[img]http://www.flyheart.com/bbs/attach/2002/11/07/59790-signature-embed.jpg[/img]
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Try these system variable values:

JAVA_HOME=C:\jdk
PATH=%JAVA_HOME%\bin;%CATALINA_HOME%\bin...

Sheldon Fernandes
huanyu zhao
Greenhorn

Joined: Feb 22, 2001
Posts: 29
Originally posted by Sheldon Fernandes:
Try these system variable values:

JAVA_HOME=C:\jdk
PATH=%JAVA_HOME%\bin;%CATALINA_HOME%\bin...

Sheldon Fernandes

the same error...still

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
huanyu zhao
Greenhorn

Joined: Feb 22, 2001
Posts: 29
my enviroment is
win2003 std sever
JavaTM 2 SDK, Standard Edition Version 1.4.2
Tomcat5
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 58861

59

Since this is in all probability a Tomcat setup issue, I'm moving this on to the Tomcat forum.

Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
It doesn't look like C:\jdk is the JAVA_HOME for your JDK 1.4.2 installation.

The folder will be named something like "jdk1.4.2" and would contain the following folders
- bin
- include
- jre
- lib
Change JAVA_HOME to the right jdk 1.4.2 installation.
CATALINA_HOME should point to the directory in which Tomcat 5 has been installed.

The lib folder contains tools.jar which has your javac utility.
Sheldon Fernandes
[ October 01, 2004: Message edited by: Sheldon Fernandes ]
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
If you do not have a JDK installed, you could still work with a JRE. But you would need tools.jar to be placed somewhere in your server classpath.

The below is an extract relevant to your problem.
Java location: The installer will use the registry or the JAVA_HOME environment variable to determine the base path of the JDK or a JRE. If only a JRE (or an incorrect path) is specified, Tomcat will run but will be unable to compile JSP pages at runtime. Either all webapps will need to be precompiled (this can be easily done using the Tomcat deployer), or the lib\tools.jar file from a JDK installation must be copied to the common\lib path of the Tomcat installation.

Sheldon Fernandes
huanyu zhao
Greenhorn

Joined: Feb 22, 2001
Posts: 29
the lib\tools.jar file from a JDK installation must be copied to the common\lib path of the Tomcat installation.

this sentece makes my example worked!
thankx
Jean Gravier
Greenhorn

Joined: Oct 21, 2004
Posts: 1
Had the same problem with win2k server, same solution worked

I agree. Here's the link: http://aspose.com/file-tools

subject: new to jsp----a small problem about jsp compile