Results 1 to 8 of 8

Thread: Unable to change / set JAVA environment variables

  1. #1

    Default Unable to change / set JAVA environment variables

    Hello

    OpenSUSE 11.4 install successful as far as I can determine but want to run with Java 1.6.0_23.

    Java installed OK but despite repeated changes to /etc/profile, /etc/java/java.conf, /etc/environment and renaming alljava.csh and alljava.sh in /etc/profile.d each reboot sets JAVA_HOME and JRE_HOME back to their previous settings /usr/lib/jvm/jre

    Despite having this in each of the above files -

    JAVA_HOME=/usr/java/jdk1.6.0_23/bin
    export JAVA_HOME

    JRE_HOME=/usr/java/jdk1.6.0_23/bin
    export JRE_HOME

    I would appreciate some thoughts, I suspect there are many more files that set these variables and I either want to find and correct all these or completely remove all Java (multiple versions seem to have been installed by OpenSUSE 11.4) and start again.

    Apologies, complete newbie so will need some hand-holding / simple instructions.

    Thanks

  2. #2
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Unable to change / set JAVA environment variables

    On 2011-10-26 15:26, activenewbie wrote:
    >
    > Hello
    >
    > OpenSUSE 11.4 install successful as far as I can determine but want to
    > run with Java 1.6.0_23.
    >
    > Java installed OK but despite repeated changes to /etc/profile,
    > /etc/java/java.conf, /etc/environment and renaming alljava.csh and


    Use update-alternatives

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)

  3. #3

    Default Re: Unable to change / set JAVA environment variables

    Hi,

    perhaps setting it in ~/.bashrc will help.

    HTH

    Lenwolf

  4. #4
    Join Date
    Aug 2008
    Location
    Brazil
    Posts
    2,844

    Default Re: Unable to change / set JAVA environment variables

    In 11.3 there is a script to change java environments that set all the necessary variables. I don't recall it's name/location right now, but it shouldn't be too hard to find references to it in these fora. I guess it's still there in 11.4.

    Another option may be to remove the unwanted java packages (openjdk, icetea or whatever) with yast's software manager. This will set the required environment variables in an *unmodified* system. Not sure about what you already changed, YMMV.

    Edit: robin_listas got it.

  5. #5
    Join Date
    Jun 2008
    Location
    Earth - Denmark
    Posts
    10,730

    Default Re: Unable to change / set JAVA environment variables

    -=WELCOME=- new poster!!

    > or completely remove all Java (multiple versions seem to have been
    > installed by OpenSUSE 11.4) and start again.


    a default install of openSUSE 11.4 will install openJDK, only..

    so, i can only guess you installed Java 1.6.0_23 on top, without first
    uninstalling the open java..

    question: must you run the _23 or is it ok to run the newer _26, like me:

    denverd@linux-os114:~> java -version
    java version "1.6.0_26"
    Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
    Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode)

    if so, it is pretty simple to install using YaST > Software Management,
    just launch that (give root pass when requested) search on java select
    to uninstall the openJDK and add the SUN Java..


    > Apologies, complete newbie so will need some hand-holding / simple
    > instructions.


    hope that is simple enough, if not, try some of this:
    http://doc.opensuse.org/products/ope...cha.y2.sw.html

    come back for more help or proclamation of success..

    --
    DD
    http://tinyurl.com/DD-Caveat
    openSUSE®, the "German Automobiles" of operating systems

  6. #6
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,951
    Blog Entries
    2

    Default Re: Unable to change / set JAVA environment variables

    Quote Originally Posted by robin_listas View Post
    On 2011-10-26 15:26, activenewbie wrote:
    >
    > Hello
    >
    > OpenSUSE 11.4 install successful as far as I can determine but want to
    > run with Java 1.6.0_23.
    >
    > Java installed OK but despite repeated changes to /etc/profile,
    > /etc/java/java.conf, /etc/environment and renaming alljava.csh and


    Use update-alternatives

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 11.4 x86_64 "Celadon" at Telcontar)
    Been a few years since I've done this, AFAIK nothingg has changed. Do a search for threads related to me and java.

    AFAIK update-alternatives only enables you to choose and activate an installed jvm or jdk, there is nothing that supports configuring persistent java environment variables.

    The correct procedure should be in my old threads, or if you really think you've tried your best then post exactly what you've tried and the reference you're using as a guide.

    HTH,
    Tony

  7. #7

    Default Re: Unable to change / set JAVA environment variables

    Thank you for your prompt responses, most appreciated.

    It was actually bash.bashrc that solved the issue.

    Unfortunately have come unstuck when attempting to get tomcat working so again any assistance appreciated.

    The move and link appeared to work -
    mv apache-tomcat-5.5.31 /usr/local/apps
    ln -s apache-tomcat-5.5.17/ tomcat

    Adding CATALINA_HOME ro bash.bashrc ok

    Execute permissions seem ok -
    cd /usr/local/apps/tomcat/bin
    chmod +x *.sh

    Copy to startup and execute -
    cp tomcat /etc/init.d
    chmod +x tomcat (in init.d)

    But attempt to enable on startup (chkconfig --add tomcat) results in tomcat: unknown service

    Attempts to start service (./tomcat start) results in bash: ./tomcat is a directory

    Appreciate your thoughts.

    Regards

    activenewbie

  8. #8
    Join Date
    Jun 2008
    Location
    San Diego, Ca, USA
    Posts
    10,951
    Blog Entries
    2

    Default Re: Unable to change / set JAVA environment variables

    Frankly, I'm not sure what you're doing in bashrc.

    You should be setting your JAVA environment variables in a profile, and if you follow the instructions in /etc/profile, you will be instructed not to modify the contents of that file, you should create a custom file called profile.local which contains your custom commands. Do it that way, it has worked for me in the past.

    As for your latest error, could your problem be exactly as the error states... you're pointing not to an executable file - it's a directory? Inspect the target location and verify.

    Also, note that an alternative way to restart a Service is through the Advanced Services configuration in YAST. It might not be your primary method but can be a backup way of checking whether your work is sound.

    HTH,
    Tony

Posting Permissions

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