You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Paul Pearce <pp...@brightontechnology.com> on 2007/03/03 20:09:37 UTC

Tomcat 5 Install - JAVA_HOME environment variable is not defined correctly

Hi,

 

I recently installed Tomcat 5 following these excellent instructions using
the exact same versions that are referenced in the instructions:

http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html

 

When I run the install command I get:

 

root@host [/usr/local/jakarta-tomcat/bin]# ./startup.sh

 

The JAVA_HOME environment variable is not defined correctly This environment
variable is needed to run this program

NB: JAVA_HOME should point to a JDK not a JRE

 

 

>From the instructions I did the following:

**************************

Set the JAVA_HOME environment variable, by modifying /etc/profile so it
includes the following:

JAVA_HOME="/usr/java/j2sdk1.4.2"
export JAVA_HOME

/etc/profile is run at startup and when a user logs into the system, so you
will need to log out and log back in for JAVA_HOME to be defined.

exit
su -

 

However, when I check the 

 

root@host [~]# echo $JAVA_HOME

/usr/local/jdk

root@host [~]#

 

*******************************

 

it appears that "JAVA_HOME" still points to the wrong directory.  

 

I have repeatedly tried to reset the JAVA_HOME variable and searched for a
solution on Google & MARC but I am hitting a wall.

 

-- From the root level the Java (j2sdk1.4.2) is installed in the /usr/java
directory

/usr/local/jdk

 

-- Tomcat is installed in the /usr/local/jakarta-tomcat directory. 

 

OS: CentOS

 

 

I am installing this on a Virtual Private Server (VPS) at a hosted facility.


 

Any tips/suggestions would be greatly appreciated. 

 

Paul

 

 

 

 

 

 

 

 

 


Re: Tomcat 5 Install - JAVA_HOME environment variable is not defined correctly

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Paul,

Paul Pearce wrote:
> I recently installed Tomcat 5 following these excellent instructions using
> the exact same versions that are referenced in the instructions:
>
> http://www.meritonlinesystems.com/docs/apache_tomcat_redhat.html
>
> When I run the install command I get:

FYI this is not an "install" command. It's a "startup" scripe.

> root@host [/usr/local/jakarta-tomcat/bin]# ./startup.sh
> 
> The JAVA_HOME environment variable is not defined correctly This environment
> variable is needed to run this program
> 
> NB: JAVA_HOME should point to a JDK not a JRE

Okay, so JAVA_HOME doesn't point to the right place. No problem.

> Set the JAVA_HOME environment variable, by modifying /etc/profile so it
> includes the following:
> 
> JAVA_HOME="/usr/java/j2sdk1.4.2"
> export JAVA_HOME

Sounds good.

> exit
> su -

I'm not sure if "su -" counts as a login shell (and might skip
/etc/profile). You might also want to:

# source /etc/profile

> However, when I check the 
> 
> root@host [~]# echo $JAVA_HOME
> 
> /usr/local/jdk

Is this what you get when you completely logout and then ssh back into
the server?

If JAVA_HOME is set to /usr/local/jdk, then perhaps your java
installation has modified /etc/profile or another environmental setup
script to set this value. If you modified /etc/profile and set this
value /earlier/ in the file, then the "bad" value will clobber yours and
it will not look like your EXPORT is working properly.

Try looking for other places where JAVA_HOME is set in /etc. Try
/etc/profile, /etc/bash_*, /etc/csh*, /etc/login, etc. You could also
try your own login scripts (~/.bash_*, ~/.login, etc.).

> it appears that "JAVA_HOME" still points to the wrong directory.  

You could always try this:

$ export JAVA_HOME=/usr/java/j2sdk1.4.2
$ /usr/local/jakarta-tomcat/bin/startup.sh

This would at least prove to you that, when JAVA_HOME is correctly set,
that Tomcat starts up properly.

After you have verified that, you can move on to try to set JAVA_HOME
properly all the time.

Why do you have both Java 1.4 and JDK 1.5 installed at the same time?

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF6cyD9CaO5/Lv0PARAj+BAJ9uWp7OfSiL2tPRe7oItWBPIafCqQCdGkWQ
A04+rpj4amviDvv7cXN8BBE=
=w5xD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org