Tomcat javac and war

R

Root

I have a new context that I added by war. I get the 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


But all the examples work fine. Why would that be?

TIA
 
D

Dave Monroe

Root said:
I have a new context that I added by war. I get the 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


But all the examples work fine. Why would that be?

TIA

If you're using a .war file, everything should already be compiled and ready to go.

How is javac getting involved with this?
 
R

Rob Shepherd

Root said:
I have a new context that I added by war. I get the 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


But all the examples work fine. Why would that be?

TIA

Perhaps you have a JRE java installation and not a JDK.

The terminology is set to change from java 1.5.0, however

A JRE only contains enough to *run* java applications and other minor stuff such the RMI
server.

The JDK however contains all the compilation tools {javac, rmic, etc} as well as the JRE.

there should be a javac{.exe} file in JAVA_HOME/bin/ as part of the JDK but java{.exe} may
be found in JAVA_HOME/jre/bin.

HTH

Rob
 
R

Root

Rob Shepherd said:
Perhaps you have a JRE java installation and not a JDK.

The terminology is set to change from java 1.5.0, however

A JRE only contains enough to *run* java applications and other minor stuff such the RMI
server.

The JDK however contains all the compilation tools {javac, rmic, etc} as well as the JRE.

there should be a javac{.exe} file in JAVA_HOME/bin/ as part of the JDK but java{.exe} may
be found in JAVA_HOME/jre/bin.

HTH

Rob


Exactly so where is this being set in the war file because the examples work
fine...
 
M

Manfred Rosenboom

Your WAR file contains JSPs. During the activation of your
WAR file (= new context) in Tomcat, the JSPs will be compiled.
Tomcat (or the Jasper part in Tomcat) uses by default the
com.sun.tools.javac.Main class from the JDK's tools.jar file
(located at $JAVA_HOME/lib) for this purpose. This won't work,
if Tomcat is started with a JRE.

As an alternative, you can add also the compiled JSPs to your WAR
file. That's the reason, why the Tomcat examples run on your
machine.

Best,
Manfred
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top