Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Problems with setting the JAVA_HOME variable


    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:

    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:

    Also, in my /etc/profile I have put the path to my java in the PATH variable, like this:
    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.


  2. #2
    i use java too. In /etc/profile you have a section

    # Make path more comfortable
    if test -z "$PROFILEREAD" ; then
        if test "$HOME" != "/" ; then
    	for dir in $HOME/bin/$CPU $HOME/bin ; do
    	    test -d $dir && PATH=$dir:$PATH
        if test "$UID" = 0 ; then
    	test -d /opt/kde3/sbin  && PATH=/opt/kde3/sbin:$PATH
        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 \
    	test -d $dir && PATH=$PATH:$dir
        unset dir
        export PATH
    and for me works.

    Registered Linux user #471256
    Don`t give up so easy...

Posting Permissions

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