You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ted Weatherly <te...@sendmail.com> on 2003/09/20 01:54:27 UTC

Running tomcat with JRE + tools.jar

Hello All,

I know you're supposed to run tomcat using the SDK but I want to avoid 
that if possible.  Instead, I am trying to run tomcat 4.1 using the 
JRE...and I still want the ability to compile servlets.  I read 
somewhere that you can accomplish this by copying tools.jar to the 
$jre_home/lib directory.  I tried this and I get:

 > ./startup.sh
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program

My JAVA_HOME is set to the base of my JRE (/usr/java/j2re1.4.2_01/). 
That path is valid.  Tomcat starts if I set JAVA_HOME to the base of my SDK.

What do I have to do to get Tomcat to run with the JRE?  Is there a doc 
for this?

-Ted

PS> You can redistribute the SDK if it is bundled with your software, 
right?  The legal agreement on java.sun.com seems to confirm this ("The 
program [SDK] must add significant and primary functionality to the 
software.").  I've read in a few forums, though, that you can only 
redistribute the JRE.  Perhaps Sun's policy has changed?


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Running tomcat with JRE + tools.jar

Posted by Stefan Lasiewski <st...@iii.com>.

> -----Original Message-----
> From: Ted Weatherly [mailto:ted@sendmail.com]
> Sent: Friday, September 19, 2003 4:54 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Running tomcat with JRE + tools.jar

Hello from around the corner!

> I know you're supposed to run tomcat using the SDK but I want
> to avoid
> that if possible.  Instead, I am trying to run tomcat 4.1 using the
> JRE...and I still want the ability to compile servlets.  I read
> somewhere that you can accomplish this by copying tools.jar to the
> $jre_home/lib directory.  I tried this and I get:

It is possible. You are on the right track.

You also need to modify the startup scripts a bit. See below:

>  > ./startup.sh
> The JAVA_HOME environment variable is not defined correctly
> This environment variable is needed to run this program

If you search on this error message, you will see that it comes from
setclasspath.sh :

% grep "The JAVA_HOME environment variable is not defined correctly" *
setclasspath.sh:    echo "The JAVA_HOME environment variable is not defined
correctly"
setclasspath.sh:    echo "The JAVA_HOME environment variable is not defined
correctly"

setclasspath.sh contains the following code:

  if [ ! -r "$JAVA_HOME"/bin/java -o ! -r "$JAVA_HOME"/bin/jdb -o ! -r
"$JAVA_HO
ME"/bin/javac ]; then
    echo "The JAVA_HOME environment variable is not defined correctly"

Neither javac or jdb are included with the JRE. You need to modify this
expression so that it only looks for lib/tools.jar . I don't think the jdb
is mandatory unless you need to run in debug mode.

And then, you need to make sure the CLASSPATH includes the path to tools.jar
. I forget exactly how to do that.

> My JAVA_HOME is set to the base of my JRE (/usr/java/j2re1.4.2_01/).
> That path is valid.  Tomcat starts if I set JAVA_HOME to the
> base of my SDK.

That's because Tomcat can find the jdb & the javac, because they are under
your SDK.


> What do I have to do to get Tomcat to run with the JRE?  Is
> there a doc
> for this?
>
> -Ted
>
> PS> You can redistribute the SDK if it is bundled with your software,
> right?  The legal agreement on java.sun.com seems to confirm
> this ("The
> program [SDK] must add significant and primary functionality to the
> software.").  I've read in a few forums, though, that you can only
> redistribute the JRE.  Perhaps Sun's policy has changed?

Read the license included with the JDK. It will specifically state which
files can be redistributed.

-= Stefan


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Running tomcat with JRE + tools.jar

Posted by Stefan Lasiewski <st...@iii.com>.

> -----Original Message-----
> From: Ted Weatherly [mailto:ted@sendmail.com]
> Sent: Friday, September 19, 2003 4:54 PM
> To: tomcat-user@jakarta.apache.org
> Subject: Running tomcat with JRE + tools.jar

Hello from around the corner!

> I know you're supposed to run tomcat using the SDK but I want
> to avoid
> that if possible.  Instead, I am trying to run tomcat 4.1 using the
> JRE...and I still want the ability to compile servlets.  I read
> somewhere that you can accomplish this by copying tools.jar to the
> $jre_home/lib directory.  I tried this and I get:

It is possible. You are on the right track.

You also need to modify the startup scripts a bit. See below:

>  > ./startup.sh
> The JAVA_HOME environment variable is not defined correctly
> This environment variable is needed to run this program

If you search on this error message, you will see that it comes from
setclasspath.sh :

% grep "The JAVA_HOME environment variable is not defined correctly" *
setclasspath.sh:    echo "The JAVA_HOME environment variable is not defined
correctly"
setclasspath.sh:    echo "The JAVA_HOME environment variable is not defined
correctly"

setclasspath.sh contains the following code:

  if [ ! -r "$JAVA_HOME"/bin/java -o ! -r "$JAVA_HOME"/bin/jdb -o ! -r
"$JAVA_HO
ME"/bin/javac ]; then
    echo "The JAVA_HOME environment variable is not defined correctly"

Neither javac or jdb are included with the JRE. You need to modify this
expression so that it only looks for lib/tools.jar . I don't think the jdb
is mandatory unless you need to run in debug mode.

And then, you need to make sure the CLASSPATH includes the path to tools.jar
. I forget exactly how to do that.

> My JAVA_HOME is set to the base of my JRE (/usr/java/j2re1.4.2_01/).
> That path is valid.  Tomcat starts if I set JAVA_HOME to the
> base of my SDK.

That's because Tomcat can find the jdb & the javac, because they are under
your SDK.


> What do I have to do to get Tomcat to run with the JRE?  Is
> there a doc
> for this?
>
> -Ted
>
> PS> You can redistribute the SDK if it is bundled with your software,
> right?  The legal agreement on java.sun.com seems to confirm
> this ("The
> program [SDK] must add significant and primary functionality to the
> software.").  I've read in a few forums, though, that you can only
> redistribute the JRE.  Perhaps Sun's policy has changed?

Read the license included with the JDK. It will specifically state which
files can be redistributed.

-= Stefan