Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-22-2007, 01:26 PM   #1
LQ Newbie
Registered: Oct 2007
Posts: 3

Rep: Reputation: 0
How to set JAVA_HOME for Tomcat


I need to set an environment variable JAVA_HOME for Apache Tomcat to use. I know how do this on Windows but I'm struggling with Fedora 8. I tried entering this in a shell first and got the following:
[user@localhost ~]$ export java_home=/usr/java/jdk
[user@localhost ~]$ export PATH=$java_home/bin:$PATH
[user@localhost ~]$ cd /usr/tomcat5/apache-tomcat-5.5.25/bin
[user@localhost bin]$ ./
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
[user@localhost bin]$

Also I opened my /home/user/.bashrc file expecting to see a "PATH="... variable but the following is all that's in there:
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

# User specific aliases and functions

I did some more 'Googling' then tried the following with some success however when tried to connect to tomcat using http://localhost:8080 I get a "Problem loading page" error. All suggestions will be welcome as I'm pretty clueless using Linux. Thanks.

[user@localhost ~]$ echo $PATH
[user@localhost ~]$ export JAVA_HOME=/usr/java/jdk/bin/java
[user@localhost ~]$ export PATH=$PATH:/usr/java/jdk/bin
[user@localhost ~]$ echo $JAVA_HOME
[user@localhost ~]$ echo $PATH
[user@localhost ~]$ cd /usr/tomcat5/apache-tomcat-5.5.25/bin
[user@localhost bin]$ ./
Using CATALINA_BASE: /usr/tomcat5/apache-tomcat-5.5.25
Using CATALINA_HOME: /usr/tomcat5/apache-tomcat-5.5.25
Using CATALINA_TMPDIR: /usr/tomcat5/apache-tomcat-5.5.25/temp
Using JRE_HOME: /usr/java/jdk/bin/java
touch: cannot touch `/usr/tomcat5/apache-tomcat-5.5.25/logs/catalina.out': Permission denied
/usr/tomcat5/apache-tomcat-5.5.25/bin/ line 273: /usr/tomcat5/apache-tomcat-5.5.25/logs/catalina.out: Permission denied
[user@localhost bin]$ su
[root@localhost bin]# ./
Using CATALINA_BASE: /usr/tomcat5/apache-tomcat-5.5.25
Using CATALINA_HOME: /usr/tomcat5/apache-tomcat-5.5.25
Using CATALINA_TMPDIR: /usr/tomcat5/apache-tomcat-5.5.25/temp
Using JRE_HOME: /usr/java/jdk/bin/java
[root@localhost bin]#
Old 11-22-2007, 03:51 PM   #2
harry edwards
Registered: Nov 2007
Location: Lincolnshire, UK
Distribution: CentOS, Fedora, and Suse
Posts: 365

Rep: Reputation: 48
You show the JAVA_HOME under the user account and then later 'su' to root. I'm pretty certain (not definite) that the users environment settings will not be passed into root's session. Try setting the environment settings as root.
Old 11-26-2007, 04:50 AM   #3
LQ Newbie
Registered: May 2007
Distribution: RedHat 9, ES4, CentOS4
Posts: 16

Rep: Reputation: 0
Check your box with other jvm installed like "gcj".
If installed, remove them first.

good luck


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set JAVA_HOME in rajaniyer123 Linux - Software 1 10-06-2007 05:34 AM
How to set JAVA_HOME in REDHAT 9.0 Linux? tejpatil Linux - Newbie 5 05-23-2004 02:17 PM
How to set JAVA_HOME in REDHAT 9.0 Linux? tejpatil Linux - General 1 05-23-2004 07:32 AM
JAVA_HOME path not set for all users tantric Linux - Software 5 03-29-2004 02:25 PM
JAVA_HOME and tomcat mbbender Linux - Software 5 07-07-2003 09:39 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration