Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I have problems with setting my JAVA_HOME variable. I am using Slackware 12.0, bash shell. This is a question for the 'Linux Newbie' forum (not slackware-specific), and I have ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2008
    Posts
    32

    Problems with setting the JAVA_HOME variable


    Hello,

    I have problems with setting my JAVA_HOME variable. I am using Slackware 12.0, bash shell.
    This is a question for the 'Linux Newbie' forum (not slackware-specific), and I have posted it there some hours ago, however, nobody is answering there to it, and I am still stuck with the problem.

    I have set JAVA_HOME in my /etc/profile, like this:

    JAVA_HOME=/home/username/programs/jdk1.6.0_7/bin:$JAVA_HOME
    export JAVA_HOME

    but when I login in with my user name and type env on the command line, I get for JAVA_HOME the following:
    JAVA_HOME=/usr/lib/java

    Also, in my /etc/profile I have put the path to my java in the PATH variable, like this:
    PATH=/home/username/programs/jdk1.6.0_7/bin:/usr/local/bin:$PATH
    export PATH

    and when I type env when I login, then the PATH variable contains correctly the path to the jdk (as I have put it into /etc/profile).

    I expect that after I have set everything as I want in /etc/profile, and restart the computer then what I have set will be relevant and when I login and type env, I will get values to the variables equal to those I have set in /etc/profile. Why it does not happen?

    I have particularly a problem with a Java application, which I want to run. When I type ant, I get:
    error: JAVA_HOME is not defined correctly.
    We cannot execute /usr/lib/java/bin/java.

    Thanks a lot.

    Regards

  2. #2
    Linux Newbie bobescalin2005's Avatar
    Join Date
    Oct 2005
    Posts
    167
    i use java too. In /etc/profile you have a section

    Code:
    #
    # Make path more comfortable
    #
    if test -z "$PROFILEREAD" ; then
        PATH=/usr/local/bin:/usr/bin:/bin
        if test "$HOME" != "/" ; then
    	for dir in $HOME/bin/$CPU $HOME/bin ; do
    	    test -d $dir && PATH=$dir:$PATH
    	done
        fi
        if test "$UID" = 0 ; then
    	test -d /opt/kde3/sbin  && PATH=/opt/kde3/sbin:$PATH
    	PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
        fi
        for dir in	/usr/X11/bin \
    		/usr/bin/X11 \
    		/usr/X11R6/bin \
    		/var/lib/dosemu \
    		/usr/games \
    		/opt/bin \
    		/opt/kde3/bin \
    		/opt/kde2/bin \
    		/opt/kde/bin \
    		/usr/openwin/bin \
    		/opt/cross/bin \
    		/usr/lib/jdk1.6.0_11/jre/bin
    
        do
    	test -d $dir && PATH=$PATH:$dir
        done
        unset dir
        export PATH
    fi
    and for me works.

    Cheers!
    Registered Linux user #471256
    http://counter.li.org
    Don`t give up so easy...
    calin

Posting Permissions

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