Symbolic link and Java

I am trying to create a softlink that points to init.d, as the following:

ln -s /etc/init.d/funambol /opt/funambol/bin/funambol

However, when ever I try to execute the softlink, it throws me an error "Please set JAVA_HOME to a valid jre".

Upon research, I appears that it uses it own jre: /opt/funambol/tools/jre-1.5.0., and I have tried to set JAVA_HOME but it did not work.

How can I resolve this?
LVL 21
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

check these two files in that user's home directory, you may find the already set parameter for JAVA_HOME or if you not found then set JAVA_HOME in one of these file.

# grep -i "JAVA_HOME" ~/.bash_profile

# grep -i "JAVA_HOME" ~/.bashrc

> /opt/funambol/tools/jre-1.5.0
If your java excuteable binary is in /opt/funambol/tools/jre-1.5.0/bin/java, then set JAVA_HOME in /opt/funambol/bin/funambol
such as (assume it is a borne or bash shell script)

export JAVA_HOME=/opt/funambol/tools/jre-1.5.0
MazdajaiAuthor Commented:
Changing the JAVA_HOME does not work.

I may have mistaken here, JAVA_HOME is the install of the jdk; and /opt/funambol/tools/jre-1.5.0 is
tools / library? The application runs fine in the /opt/funambol/bin folder, but it refuse to rune in init.d.

# .bashrc

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

# User specific aliases and functions

Open in new window

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc

# User specific environment and startup programs


export PATH

Open in new window

which java

Open in new window

 java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing)

Open in new window

Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

It seems that JAVA_HOME is called in the script /etc/init.d/funambol  and having diffrenet values for the same.

I think you should go in that script and need to modify the path for JAVA_HOME.
MazdajaiAuthor Commented:
What should I change the JAVA_HOME to?

Following is part of the script that calls the error:


cd `dirname $0`
FUNAMBOL_HOME=`(cd .. ; pwd)`

if [ ! -d $FUNAMBOL_HOME/config ]; then
    # maybe we are in Funambol/tool/bin

# Setting the JAVA_HOME to the JRE in the bundle if not set or if not correctly set
if [ -z "$JAVA_HOME" ]; then
    export JAVA_HOME=$FUNAMBOL_HOME/tools/jre-1.5.0/jre
    if [ ! -f "$JAVA_HOME/bin/java" ]; then
        export JAVA_HOME=$FUNAMBOL_HOME/tools/jre-1.5.0/jre

if [ -z "$JAVA_HOME" ]; then
  echo "Please, set JAVA_HOME before running this script."
  exit 1

if [ ! -f "$JAVA_HOME/bin/java" ]
    echo "Please set JAVA_HOME to the path of a valid jre."

export J2EE_HOME=${FUNAMBOL_HOME}/tools/tomcat
export CATALINA_HOME=${FUNAMBOL_HOME}/tools/tomcat


export LANG=en_US.utf-8

cd ${J2EE_HOME}/bin


case $1 in

    if [ "$COMED" = "true" ] ; then

Open in new window

If i change the JAVA_HOME and run the softlink, it will not run because the script calls it owns variable.

export JAVA_HOME=/opt/Funambol/tools/jre-1.5.0/jre  
/etc/init.d/funambol start
/etc/init.d/funambol: line 42: cd: /etc/../tools/tomcat/bin: No such file or directory
sh: /etc/../bin/hypersonic: No such file or directory
sh: /etc/../bin/ctp-server: No such file or directory
sh: /etc/../bin/funambol-server: No such file or directory
sh: /etc/../bin/inbox-listener: No such file or directory
sh: /etc/../bin/pim-listener: No such file or directory
Got it.

No need to change any JAVA_HOME path. Just change the value for variable FUNAMBOL_HOME.

Change it from  FUNAMBOL_HOME=`(cd .. ; pwd)`

to FUNAMBOL_HOME=/opt/funambol/

and your symbolic link of script will also work.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MazdajaiAuthor Commented:
Bravo! The script do not use relative path - which caused it to break when it moves to elsewhere.

Thanks a lot!
MazdajaiAuthor Commented:
Correct a typo on my previous post - it use relative path instead of absolute.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.