tags:

views:

249

answers:

1

I've been trying to get Jetty to run my web app via a custom launcher (embedded). I am trying to figure out how to tell Jetty which java compiler to use for JSPs. I want to do what java -jar start.jar -OPTIONS=jsp does, but without using start.jar.

Here is what shows on the console:

Javac exception, 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

Do I need to put the javac libraries into my classpath?

+1  A: 

You need to have a JAVA_HOME environment variable pointing to the root folder of the JDK. Here's an extract of the Sun guide on the subject:

2) To set JAVA_HOME:

  1. Right click My Computer and select Properties.
  2. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1.6.0_02.

Most servletcontainers like Tomcat doesn't need it because they ships with its own compiler.

BalusC
actually I had this, it seems I needed to have tools.jar in my classpath.
Justin
To be sure, aren't you confusing JDK with JRE?
BalusC
I'm using the JRE inside of the JDK (jdk1.6/jre/bin/java). The java compiler (in tools.jar) is not by default on the classpath, AFAIK.
Justin
Interesting, I didn't know that tomcat had its own compiler; Thanks. This probably works around licensing issues with redistributing the JDK. The jsp engine I pulled out of eclipse used some ant javac task to compile the JSP.
Justin