Find the answer to your Linux question:
Results 1 to 9 of 9
Hello Forum, I am a newbie on Linux. I am using Suse 9 server edition. I am trying to set environment variable JAVA_HOME for my jdk installation. for that I ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5

    Unhappy Urgent Please help !

    Hello Forum,
    I am a newbie on Linux. I am using Suse 9 server edition.
    I am trying to set environment variable JAVA_HOME for my jdk installation.
    for that I have edited - etc/profile this how it looks like now.


    export PATH JAVA_HOME/home/usr/jdk1.5.0_12
    export JAVA_HOME
    now when I run the command echo $JAVA_HOME it still returns. usr/lib/java/jre..
    I am tired of trying out plz help me.
    thanks

  2. #2
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    658
    Try this instead

    Code:
    export JAVA_HOME=/home/usr/jdk1.5.0_12
    echo $JAVA_HOME
    Let us know how you get on,

    Chris...
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5

    Unhappy No Success

    Hello thanks for reeplying but this doesnt seem to work this is how my
    /etc/profile looks like now,
    export PATH JAVA_HOME/home/usr/jdk1.5.0_12/bin:$PATH
    export JAVA_HOME=/home/usr/jdk1.5.0_12
    echo $JAVA_HOME

    still the same result.Plz help meeee...

  4. #4
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    658
    Try doing this from the command line rather than putting things in /etc/profile for now. Once we have it working then we can look at automating it.

    Quote Originally Posted by Somil View Post
    export PATH JAVA_HOME/home/usr/jdk1.5.0_12/bin:$PATH
    I don't think that like does what you want.

    Try running the lines I posted before in a shell by themselves and post the actual output including any errors.

    Let us know how you get on,

    Chris...
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5
    Hello Chris,
    I did what you said but seems like that Its not gonna work, Since After setting the Variable . When I log off & then log in again.
    & Run the command echo $JAVA_HOME . it again returns the default path,
    ie usr/lib/java/jre . & not home/usr/jdk. Do I need to esdit alljava.sh file?


    thanks
    Somil

  6. #6
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    658
    I'm trying to break your problem into smaller parts. Once we have got the environment variables set correctly we can look at automating it.

    Did those commands I gave you work for the current shell?

    If so, we can look at the /etc/profile file.

    Chris...
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

  7. #7
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5
    Yes , I was able to Echo the correct path. but for that session only. Can u tell me how to make it Permanent. That will be great help.

    thanks
    Somil

  8. #8
    Linux Enthusiast
    Join Date
    Apr 2004
    Location
    UK
    Posts
    658
    In theory putting this line in /etc/profile would fix you up:

    Code:
    export JAVA_HOME=/home/usr/jdk1.5.0_12
    However you posted before that you have already tried it and it didn't work. Can you post your /etc/profile file here so we can take a look please.

    There may be a problem in it or in one of the files it calls.

    Let us know how you get on,

    Chris...
    To be good, you must first be bad. "Newbie" is a rank, not a slight.

  9. #9
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5
    Thanks for replying,I dont know which part of the Profille to post in here but I think this is the one you are looking For,

    f test -z "$PROFILEREAD" ; then
    PATH=/usr/local/bin:/usr/bin:usr/sbin:/sbin:/usr/X11R6/bin:/bin
    if test "$HOME" != "/" ; then
    for dir in $HOME/bin/$CPU $HOME/bin ; do
    test -d $dir && PATH=$dir:$PATH
    done
    fi
    test "$UID" = 0 && PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
    for dir in /var/lib/dosemu \
    /usr/games \
    /opt/bin \
    /opt/gnome/bin \
    /opt/kde3/bin \
    /opt/kde2/bin \
    /opt/kde/bin \
    /usr/openwin/bin \
    /opt/cross/bin
    do
    test -d $dir && PATH=$PATH:$dir
    done
    unset dir
    export PATH JAVA_HOME="/home/usr/jdk1.5.0_12"
    export JAVA_HOME

    fi


    Now how should I make it permanent?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...