LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-05-2007, 07:11 PM   #1
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Rep: Reputation: 31
ssl-explorer complains of no JAVA_HOME


Hello all,

I am trying to get ssl-explorer up and running so I can test it out an I am running into a problem. I am trying to install the servers on my Fedora Core 6 machine and it is giving me the following complaint:

JAVA_HOME points to a missing or invalid Java runtime,
please set JAVA_HOME environment variable or provide
-j <java-home> argument.

Even when I run it with the -j option it still gives me the same complaint.

Can anyone tell me how to set the JAVA_HOME Environment Variable?

I have tried specifying the following in my /etc/profile.d/java.sh:
export JAVA_HOME=/opt/jre1.5.0_11/bin

I have tried the following on the command line as root:
export JAVA_HOME=/opt/jre1.5.0_11/bin

nothing has worked for me.
 
Old 04-05-2007, 07:47 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

The JAVA_HOME variable should point to the Java install directory, so just chop the /bin off the end of the path:
Code:
export JAVA_HOME="/opt/jre1.5.0_11"
Dave
 
Old 04-05-2007, 07:51 PM   #3
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
How can I tell if this worked? is there an echo command I can use that should tell me what the environment variable points to?
 
Old 04-05-2007, 07:53 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Yup
Code:
echo $JAVA_HOME
Dave
 
Old 04-05-2007, 07:59 PM   #5
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Of course (I should have known). - Thanks for that. It does show what I have that it is set.

[lem@linux ~]$ echo $JAVA_HOME
/opt/jre1.5.0_11

Unfortunately when I try to run it, I still get the same error.

[root@linux linux]# ./install-service
Detecting Java
JAVA_HOME points to a missing or invalid Java runtime,
please set JAVA_HOME environment variable or provide
-j <java-home> argument.

Anyone got any ideas of what I can do?
 
Old 04-05-2007, 08:35 PM   #6
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Obvious question:
Does /opt/jre1.5.0_11 actually contain a Java installation?

Also, what type of file is install-service ? Is it a shell script, or a binary? If it's a shell script, you could probably take a look inside it, and see how it determines whether or not the JAVA_HOME variable points to a Java install.

Dave
 
Old 04-06-2007, 02:41 AM   #7
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
In the Java directory there are the following files:
[lem@linux linux]$ ls -al /opt/jre*/bin
total 1464
drwxr-xr-x 2 root root 4096 Dec 15 07:34 .
drwxr-xr-x 7 root root 4096 Dec 15 07:34 ..
-rwxr-xr-x 1 root root 4153 Dec 15 07:12 ControlPanel
-rwxr-xr-x 1 root root 65076 Dec 15 06:06 java
-rwxr-xr-x 1 root root 25730 Dec 15 07:12 java_vm
-rwxr-xr-x 1 root root 175978 Dec 15 07:12 javaws
-rwxr-xr-x 1 root root 62356 Dec 15 06:19 keytool
-rwxr-xr-x 1 root root 62388 Dec 15 06:19 kinit
-rwxr-xr-x 1 root root 62388 Dec 15 06:20 klist
-rwxr-xr-x 1 root root 62388 Dec 15 06:20 ktab
-rwxr-xr-x 1 root root 62580 Dec 15 06:49 orbd
-rwxr-xr-x 1 root root 62388 Dec 15 06:51 pack200
-rwxr-xr-x 1 root root 62588 Dec 15 06:19 policytool
-rwxr-xr-x 1 root root 62356 Dec 15 06:43 rmid
-rwxr-xr-x 1 root root 62356 Dec 15 06:43 rmiregistry
-rwxr-xr-x 1 root root 62356 Dec 15 06:50 servertool
-rwxr-xr-x 1 root root 62580 Dec 15 06:49 tnameserv
-rwxr-xr-x 1 root root 357373 Dec 15 06:50 unpack200

I don't know what I am looking at when I look at the install-services so I am just going to post what is in it to see if you guys can make heads of it

[lem@linux linux]$ more install-service
#!/bin/bash
#
# This script will attempt to install SSL Explorer as a Linux
# service. The method of doing this differs between distributions
# so an attempt is made to guess the O/S

# Display user
usage() {
echo "usage: $0 [-o <os>] [-j <java-home>] [-n|-u] [-c <wrapper-conf>]"
}

set_wrapper_property() {
CONFFILE="${WRAPPER_CONF:-$SSLEXPLORER_HOME/conf/wrapper.conf}"
NAME="$1"
shift
VAL="$*"
FOUND=n
while read line
do
case "${line}" in
"${NAME}="*) echo "${NAME}=${VAL}"
FOUND=y ;;
*) echo "${line}" ;;
esac
done < "${CONFFILE}" > /tmp/wrapper.conf
if [ "${FOUND}" = n ]
then echo "${NAME}=${VAL}" >> /tmp/wrapper.conf
fi
cat /tmp/wrapper.conf > "${CONFFILE}" 2>/dev/null
rm -f /tmp/wrapper.conf
}

help() {
usage
echo
echo "Option"
echo " -o <os> Force operating system. Can currently"
echo " either be redhat,slackware,smoothwall,suse,debia
n,conary."
echo " -n Install the service NOT to start at boot."
echo " -u Uninstall service."
echo " -c <wrapper-conf> Location of wrapper configuration."
}

install_slackware_service() {
RC_INSTALLED=n
if [ -f /etc/rc.d/rc.sslexplorer ]
then line=$(grep "exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplore
r" /etc/rc.d/rc.sslexplorer)
if [ -n "${line}" ]
then RC_INSTALLED=y
fi
fi
if [ "${RC_INSTALLED}" = "n" ]
then echo "#!/bin/bash
#
# Init file for SSL Explorer daemon
#

if [ -f /etc/sslexplorer/service.conf ]
then source /etc/sslexplorer/service.conf
fi

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/rc.d/rc
.sslexplorer
fi
chmod a+rx /etc/rc.d/rc.sslexplorer
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/
install/platforms/linux

if [ -f /etc/rc.d/rc.local ]
then grep -v "\# Added by SSL Explorer install-service" /etc/rc.d/rc.local >
/tmp/rc.local.tmp
else echo "#!/bin/bash" > /etc/rc.d/rc.local.tmp
fi
echo "if [ -x /etc/rc.d/rc.sslexplorer ] # Added by SSL Explorer install-
service" >> /tmp/rc.local.tmp
echo "then sh /etc/rc.d/rc.sslexplorer start # Added by SSL Explorer install-
service" >> /tmp/rc.local.tmp
echo "fi # Added by SSL Explorer install-
service" >> /tmp/rc.local.tmp
mv /tmp/rc.local.tmp /etc/rc.d/rc.local
if [ "${START_ON_BOOT}" = y ]
then chmod a+rx /etc/rc.d/rc.local
else chmod a-rx /etc/rc.d/rc.local
fi
}

uninstall_slackware_service() {
if [ -f /etc/rc.d/rc.local ]
then grep -v "\# Added by SSL Explorer install-service" /etc/rc.d/rc.local >
/tmp/rc.local.tmp
mv /tmp/rc.local.tmp /etc/rc.d/rc.local
fi
rm -f /etc/rc.d/rc.sslexplorer
}

install_suse_service() {
echo "#!/bin/bash
#
### BEGIN INIT INFO
# Provides: SSL Explorer daemon
# Required-Start: $syslog $remote_fs $network
# X-UnitedLinux-Should-Start: $named $syslog $time
# Required-Stop: $syslog $remote_fs $network
# X-UnitedLinux-Should-Stop: $named $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: SSL Explorer
# Description: Start SSL Explorer to activate client's VPN access
#
# pidfile: /var/lock/subsys/sslexplorer.pid
# processname: wrapper
### END INIT INFO

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/init.d/
sslexplorer
chmod a+rx /etc/init.d/sslexplorer
if [ "${START_ON_BOOT}" = y ]
then if ! chkconfig -a sslexplorer
then echo "Failed to install service." >&2
exit 1
fi
else if ! chkconfig -d sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
fi
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/insta
ll/platforms/linux
echo "Service installed"
}

uninstall_suse_service() {
if ! chkconfig -d sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
rm -f /etc/init.d/sslexplorer
echo "Service uninstalled"
}


install_debian_service() {
mkdir -p /var/lock/subsys
echo "#!/bin/bash
#

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/init.d/
sslexplorer
chmod a+rx /etc/init.d/sslexplorer
if [ "${START_ON_BOOT}" = y ]
then if ! update-rc.d sslexplorer defaults
then echo "Failed to install service." >&2
exit 1
fi
else if ! update-rc.d -f sslexplorer remove
then echo "Failed to uninstall service." >&2
exit 1
fi
fi
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/insta
ll/platforms/linux
echo "Service installed"
}

uninstall_debian_service() {
if ! update-rc.d -f sslexplorer remove
then echo "Failed to uninstall service." >&2
exit 1
fi
rm -f /etc/init.d/sslexplorer
echo "Service uninstalled"
}

install_smoothwall_service() {
# Hack to make Install4J scripts works
ln -sf /bin/grep /bin/egrep
mkdir -p /var/lock/subsys
echo "#!/bin/bash
#
# Init file for SSL Explorer daemon
#

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/rc.d/rc
.sslexplorer
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/instal
l/platforms/linux

if [ -f /etc/rc.d/rc.sysinit ]
then grep -v "\# Added by SSL Explorer install-service" /etc/rc.d/rc.sysinit
> /tmp/rc.sysinit.tmp
else echo "#!/bin/bash" > /etc/rc.d/rc.sysinit.tmp
fi
echo "if [ -x /etc/rc.d/rc.sslexplorer ] # Added by SSL Explorer install-
service" >> /tmp/rc.sysinit.tmp
echo "then sh /etc/rc.d/rc.sslexplorer start # Added by SSL Explorer install-
service" >> /tmp/rc.sysinit.tmp
echo "fi # Added by SSL Explorer install-
service" >> /tmp/rc.sysinit.tmp
mv /tmp/rc.sysinit.tmp /etc/rc.d/rc.sysinit
chmod a+rx /etc/rc.d/rc.sysinit

if [ "${START_ON_BOOT}" = y ]
then chmod a+rx /etc/rc.d/rc.sslexplorer
else chmod a-rx /etc/rc.d/rc.sslexplorer
fi
}

uninstall_smoothwall_service() {
if [ -f /etc/rc.d/rc.sysinit ]
then grep -v "\# Added by SSL Explorer install-service" /etc/rc.d/rc.sysinit
> /tmp/rc.sysinit.tmp
mv /tmp/rc.sysinit.tmp /etc/rc.d/rc.sysinit
fi
rm -f /etc/rc.d/rc.sslexplorer
}

install_rh_service() {
echo "#!/bin/bash
#
# Init file for SSL Explorer daemon
#
# chkconfig: 345 56 26
# description: SSL Explorer daemon
#
# pidfile: /var/lock/subsys/sslexplorer.pid
# processname: wrapper

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/rc.d/in
it.d/sslexplorer
chmod a+rx /etc/rc.d/init.d/sslexplorer
if [ "${START_ON_BOOT}" = y ]
then if ! chkconfig --add sslexplorer --levels 345
then echo "Failed to install service." >&2
exit 1
fi
else if ! chkconfig --del sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
fi
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/i
nstall/platforms/linux
echo "Service installed"
}

uninstall_rh_service() {
if ! chkconfig --del sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
rm -f /etc/rc.d/init.d/sslexplorer
echo "Service uninstalled"
}

install_conary_service() {
echo "#!/bin/bash
#
# Init file for SSL Explorer daemon
#
# chkconfig: 345 56 26
# description: SSL Explorer daemon
#
# pidfile: /var/lock/subsys/sslexplorer.pid
# processname: wrapper

exec ${SSLEXPLORER_HOME}/install/platforms/linux/sslexplorer \$*" > /etc/rc.d/in
it.d/sslexplorer
chmod a+rx /etc/rc.d/init.d/sslexplorer
if [ "${START_ON_BOOT}" = y ]
then if ! chkconfig --add sslexplorer --levels 345
then echo "Failed to install service." >&2
exit 1
fi
else if ! chkconfig --del sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
fi
set_wrapper_property "wrapper.java.command" "${JAVA_HOME}/bin/java"
set_wrapper_property "wrapper.working.dir" ${SSLEXPLORER_HOME}
set_wrapper_property "wrapper.java.library.path.1" ${SSLEXPLORER_HOME}/i
nstall/platforms/linux
echo "Service installed"
}

uninstall_conary_service() {
if ! chkconfig --del sslexplorer
then echo "Failed to uninstall service." >&2
exit 1
fi
rm -f /etc/rc.d/init.d/sslexplorer
echo "Service uninstalled"
}

# Determine the installed location of SSL Explorer
export DIR=$(dirname ${0})
SSLEXPLORER_HOME=$(cd ${DIR}; cd ../../.. ; pwd)

# Initialise other variables
OS=
START_ON_BOOT=y
UNINSTALL=n

# Determine the O/S

if [ -f /etc/SuSE-release ]
then OS=suse
elif [ -f /etc/redhat-release ]
then OS=redhat
elif [ -f /etc/slackware-version ]
then OS=slackware
elif [ -f /usr/local/bin/smoothiedeath ]
then OS=smoothwall
elif [ -f /etc/debian_version ]
then OS=debian
elif [ -d /etc/conary ]
then OS=conary
fi

# Parse the command line
while [ $# -gt 0 ]
do
case "$1" in
"-j") JAVA_HOME="$2" ; shift ;;
"-o") OS="$2" l shift ; ;;
"-u") UNINSTALL="y" ;;
"-n") START_ON_BOOT="n" ;;
"-c") WRAPPER_CONF="$2" ; shift ;;
"-h") help
exit 0 ;;
*) help
exit 1 ;;
esac
shift
done

if [ "${UNINSTALL}" = "n" ]
then echo "Detecting Java"
if [ -n "${JAVA_HOME}" ]
then if [ ! -d "${JAVA_HOME}" -o ! -f "${JAVA_HOME}/bin/java" ]
then echo " JAVA_HOME points to a missing or invalid Java runtime,"
echo " please set JAVA_HOME environment variable or provide"
echo " -j <java-home> argument."
exit 1
fi
else echo " JAVA_HOME has not been set. Please set JAVA_HOME environment
"
echo " variable or provide -j <java-home> argument."
exit 1
fi
echo " Using ${JAVA_HOME}"
fi


echo "Detect OS ${OS}"

#
case "${OS}" in
suse) if [ "${UNINSTALL}" = y ]
then uninstall_suse_service
else install_suse_service
fi ;;
redhat) if [ "${UNINSTALL}" = y ]
then uninstall_rh_service
else install_rh_service
fi ;;
slackware) if [ "${UNINSTALL}" = y ]
then uninstall_slackware_service
else install_slackware_service
fi ;;
debian) if [ "${UNINSTALL}" = y ]
then uninstall_debian_service
else install_debian_service
fi ;;
smoothwall) if [ "${UNINSTALL}" = y ]
then uninstall_smoothwall_service
else install_smoothwall_service
fi ;;
conary) if [ "${UNINSTALL}" = y ]
then uninstall_conary_service
else install_conary_service
fi ;;
*) echo "OS could not be detected and no valid one specified as an argu
ment." >&2
help ;;
esac

# Clear out the temporary directory
if [ -f "${WRAPPER_CONF}" ]
then temp=$(grep "=--temp=" "${WRAPPER_CONF}"|awk -F= '{ print $3 }')
if [ -z "${temp}" ]
then temp="${SSLEXPLORER_HOME}/tmp"
fi
if [ -d "${temp}" ]
then rm -fr "${temp}/*"
fi
fi
[lem@linux linux]$
 
Old 04-06-2007, 05:15 AM   #8
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
These are the lines which matter:
Code:
if [ -n "${JAVA_HOME}" ]
then if [ ! -d "${JAVA_HOME}" -o ! -f "${JAVA_HOME}/bin/java" ]
The first checks whether $JAVA_HOME is null.
The second checks first to see if $JAVA_HOME is a directory, then checks that $JAVA_HOME/bin/java exists.
One of these chacks is failing.

Could you run the following, and post the output:
Code:
echo $JAVA_HOME
ls /opt
ls -ld $JAVA_HOME
ls -l $JAVA_HOME/bin/java
Dave
 
Old 04-06-2007, 12:28 PM   #9
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Here is what I got back:

[lem@Linux linux]$ echo $JAVA_HOME
/opt/jre1.5.0_11/bin

[lem@Linux linux]$ ls /opt
jre1.5.0_11 sslexplorer

[lem@Linux linux]$ ls -ld $JAVA_HOME
drwxr-xr-x 2 root root 4096 Dec 15 07:34 /opt/jre1.5.0_11/bin

[lem@Linux linux]$ ls -l $JAVA_HOME/bin/java
ls: /opt/jre1.5.0_11/bin/bin/java: No such file or directory
 
Old 04-06-2007, 12:40 PM   #10
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Ah.

Your $JAVA_HOME still points to /opt/jre1.5.0_11/bin . It should point to /opt/jre1.5.0_11/

Dave
 
Old 04-06-2007, 12:45 PM   #11
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Hmm ok how do I fix it? is there a place where I can delete it and then reset it?
 
Old 04-07-2007, 01:16 PM   #12
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
You said you put it in /etc/profile.d/java.sh originally.
 
Old 04-07-2007, 02:37 PM   #13
lmcilwain
Member
 
Registered: Dec 2003
Location: Maryland
Distribution: Fedora, Ubuntu, Centos, FreeBSD
Posts: 390

Original Poster
Rep: Reputation: 31
Through all this, I forgot about that file. I made the change and I was able to install the service:

[root@linux linux]# ./install-service
Detecting Java
Using /opt/jre1.5.0_11/
Detect OS redhat
Service installed

Thanks for all the help guys I really appreciate it.
 
  


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
SSL-Explorer cccc Linux - Security 2 08-17-2006 08:23 PM
Have U tried SSL Explorer jspsandhu Linux - Security 5 10-12-2005 08:49 PM
setting JAVA_HOME gauravbagga Linux - Newbie 2 03-04-2005 10:17 PM
$JAVA_HOME and $PATH magnum818 Linux - Software 2 09-30-2003 11:05 PM
JAVA_HOME and tomcat mbbender Linux - Software 5 07-07-2003 09:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:38 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