View Full Version : Installation Problem on Linux can't find JAVA_HOME
stephan
11-11-2003, 01:33 AM
I'm using Red Hat 7.1/bash and this is the error I get when I call the startup script from the jakarta bin directory.
# ./startup.sh
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
And this what I get when I check the environment variable.# echo $JAVA_HOME
/usr/java/j2sdk1.4.1_02
I tried installing the XFree libraries, but it's already installed. rpm -ivh XFre*
Preparing... ##########################[100%]
package XFree86-libs-4.1.0-25 is already installed
For what it's worth, I already have Lazslo installed on my Windows laptop and it works well, but now I would really like to get it working my linux box. Any ideas?
Stephan
bloch
11-11-2003, 08:16 AM
Does java otherwise work?
$JAVA_HOME/bin/java -help
for example?
-Eric
antun
11-11-2003, 08:19 AM
Is this an out of the box install of Red Hat? Did it come with Java installed, and JAVA_HOME set as you described, or did you install those yourself?
-Antun
stephan
11-11-2003, 11:40 AM
Originally posted by bloch
Does java otherwise work?
$JAVA_HOME/bin/java -help
for example?
-Eric
Yes, $JAVA_HOME/bin/java - help works.
Even my Eclipse installation works.
stephan
11-11-2003, 11:49 AM
Originally posted by antun
Is this an out of the box install of Red Hat? Did it come with Java installed, and JAVA_HOME set as you described, or did you install those yourself?
-Antun
I assembled this computer and installed Red Hat 7.1 myself. At some point, I installed another older jdk. Do you think this old jdk might be interfering with my new j2sdk installation?
And yes, I set the JAVA_HOME myself. Here is my .bash_profile I ended up with.
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH:$HOME/bin
JAVA_HOME=/usr/java/j2sdk1.4.1_02
# just changed bash_env from .bashrc to .bash_profile
BASH_ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME BASH_ENV PATH JAVA_HOME
umask 077
-Stephan
bloch
11-11-2003, 11:51 AM
Perhaps it's a persmissions problem.
The lines in the tomcat setclasspath.sh script that generate this error message are:
if [ ! -r "$JAVA_HOME"/bin/java ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
exit 1
fi
Can root read this file?
stephan
11-11-2003, 12:08 PM
Originally posted by bloch
Perhaps it's a persmissions problem.
The lines in the tomcat setclasspath.sh script that generate this error message are:
if [ ! -r "$JAVA_HOME"/bin/java ]; then
echo "The JAVA_HOME environment variable is not defined correctly"
echo "This environment variable is needed to run this program"
exit 1
fi
Can root read this file?
Yes.
bloch
11-11-2003, 12:39 PM
You could edit
$TOMCAT_HOME/bin/catalina.sh and
change the top line from
#!/bin/sh
to
#!/bin/sh -x
and report back. We can be pretty sure whatever user your running the script as can't read $JAVA_HOME/bin/java since that's what the script says.
-Eric
stephan
11-11-2003, 12:49 PM
Here is the problem. Here is what happens when I echo $JAVA_HOME from inside setclasspath.sh and here is what happens when I echo $JAVA_HOME from my bash shell.
[root@localhost bin]# pico setclasspath.sh
[root@localhost bin]# ./startup.sh
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program.
usr/java/j2sdk1.4.1_02
[root@localhost bin]# echo $JAVA_HOME
/usr/java/j2sdk1.4.1_02
[root@localhost bin]#
$JAVA_HOME is missing a slash at the beginning.
stephan
11-11-2003, 12:54 PM
Originally posted by bloch
You could edit
$TOMCAT_HOME/bin/catalina.sh and
change the top line from
#!/bin/sh
to
#!/bin/sh -x
and report back. We can be pretty sure whatever user your running the script as can't read $JAVA_HOME/bin/java since that's what the script says.
-Eric
Here is what happened.
[root@localhost bin]# ./startup.sh
+ JAVA_HOME=usr/java/j2sdk1.4.1_02
+ export JAVA_HOME
+ cygwin=false
++ uname
+ PRG=/root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/catalina.sh
+ '[' -h /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/catalina.sh ']'
++ dirname /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/catalina.sh
+ PRGDIR=/root/lps-1.0.2/jakarta-tomcat-4.1.12/bin
++ cd /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/..
++ pwd
+ CATALINA_HOME=/root/lps-1.0.2/jakarta-tomcat-4.1.12
+ '[' -r /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/setenv.sh ']'
+ false
+ '[' -r /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/setclasspath.sh ']'
+ BASEDIR=/root/lps-1.0.2/jakarta-tomcat-4.1.12
+ . /root/lps-1.0.2/jakarta-tomcat-4.1.12/bin/setclasspath.sh
++ '[' -z usr/java/j2sdk1.4.1_02 ']'
++ '[' '!' -r usr/java/j2sdk1.4.1_02/bin/java ']'
++ echo 'The JAVA_HOME environment variable is not defined correctly'
The JAVA_HOME environment variable is not defined correctly
++ echo 'This environment variable is needed to run this program.'
This environment variable is needed to run this program.
++ echo usr/java/j2sdk1.4.1_02
usr/java/j2sdk1.4.1_02
++ exit 1
[root@localhost bin]#
stephan
11-11-2003, 01:01 PM
I have to go. I'll work on it tonight. Thank you for your help Bloch and Antun. You got me unstuck and I feel closer to the answer now.
bloch
11-11-2003, 01:07 PM
I'd look around in the root /.profile or /root/.profile or /etc/profile or /etc/profile* or /etc/profile*/* (linux keeps moving thisstuff on me) to see if there's a setting for JAVA that's missing
the slash.
-Eric
stephan
11-11-2003, 01:34 PM
Originally posted by bloch
I'd look around in the root /.profile or /root/.profile or /etc/profile or /etc/profile* or /etc/profile*/* (linux keeps moving thisstuff on me) to see if there's a setting for JAVA that's missing
the slash.
-Eric
It's working now. "Hello Lazslo" renders on my browser. Initially, I didn't understand environment variables, I declared JAVA_HOME inside catalina.sh, and that's what was causing the trouble. Thanks guys. :D
- Stephan
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.