LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 0
How to set JAVA_HOME for Tomcat


Hi,

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]$ ./startup.sh
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
fi

# 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
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user/bin
[user@localhost ~]$ export JAVA_HOME=/usr/java/jdk/bin/java
[user@localhost ~]$ export PATH=$PATH:/usr/java/jdk/bin
[user@localhost ~]$ echo $JAVA_HOME
/usr/java/jdk/bin/java
[user@localhost ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/user/bin:/usr/java/jdk/bin
[user@localhost ~]$ cd /usr/tomcat5/apache-tomcat-5.5.25/bin
[user@localhost bin]$ ./startup.sh
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/catalina.sh: line 273: /usr/tomcat5/apache-tomcat-5.5.25/logs/catalina.out: Permission denied
[user@localhost bin]$ su
Password:
[root@localhost bin]# ./startup.sh
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, 02:51 PM   #2
harry edwards
Member
 
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, 03:50 AM   #3
mt83
LQ Newbie
 
Registered: May 2007
Distribution: RedHat 9, ES4, CentOS4
Posts: 16

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

good luck
 
  


Reply


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 catalina.sh rajaniyer123 Linux - Software 1 10-06-2007 04:34 AM
How to set JAVA_HOME in REDHAT 9.0 Linux? tejpatil Linux - Newbie 5 05-23-2004 01:17 PM
How to set JAVA_HOME in REDHAT 9.0 Linux? tejpatil Linux - General 1 05-23-2004 06:32 AM
JAVA_HOME path not set for all users tantric Linux - Software 5 03-29-2004 01:25 PM
JAVA_HOME and tomcat mbbender Linux - Software 5 07-07-2003 08:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:55 AM.

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