LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Install and use older version of Java while keeping newst version (https://www.linuxquestions.org/questions/linux-software-2/install-and-use-older-version-of-java-while-keeping-newst-version-4175464627/)

Predatorian 06-03-2013 11:44 PM

Install and use older version of Java while keeping newst version
 
Hello LQ'ers.

I watched my friend do this, but he's not around or answering his phone, but he was able to have two versions of java installed on his linux machine, which was Fedora 17 at the time, and use the older one because of incompatibilities with jdk-7u21-linux-i586.rpm. I would like to install jdk-6u43-linux-i586.rpm on CentOS 6.4 32bit. From some of my reading, I am supposed to be able to do this with 'alternatives' but as I enter the command
Code:

alternatives --display 'java'
there is nothing dipslayed, yet when I do a
Code:

java -version
I get the version:
Code:

$ java -version
java version "1.7.0_21"
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)

A program I am trying to run, is not working with 1.7, and I believe it will work with 1.6. When I try installing the jdk-6u43-linux-i586.rpm I get this error.
Code:

$ sudo rpm -i jdk-6u43-linux-i586.rpm
        package jdk-2000:1.7.0_21-fcs.i586 (which is newer than jdk-2000:1.6.0_43-fcs.i586) is already installed
        file /etc/init.d/jexec from install of jdk-2000:1.6.0_43-fcs.i586 conflicts with file from package jdk-2000:1.7.0_21-fcs.i586

Isn't there something that will allow me to select a version of java just like RVM does with different versions of Ruby?

knudfl 06-05-2013 03:03 AM

When jdk6 is installed, you can select java version with :
# /usr/sbin/alternatives --config java


? No jdk6 entry in /etc/alternatives/ ? Then an entry can be installed with :
# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_43/bin/java 2
.. When you have checked that the path really is "/usr/java/jdk1.6.0_43/bin/java"

-

grail 06-12-2013 01:13 AM

Anyone have the same advice for Arch? I am trying to get sqldeveloper installed and have been told that it is not supported by jdk 1.7 and needs 1.6 :(

The irony is not lost on me though ... I am running Arch in Virtualbox and trying to execute Sql Developer and need Java support ... 3 of the 4 are owned by Oracle!!!

grail 06-13-2013 06:49 PM

Well in case it helps (not sure my issue was the same after finding solution), I found the following useful:

Better approach: uninstall jre6 & jdk6; install jre7-openjdk, jdk7-openjdk with pacman. Then download the jdk6 .bin file from the Oracle website (jdk-6u30-linux-x64.bin at time of writing), copy it to /opt, run the .bin file as root, rename the jdkxxxx folder to "java". Now you have a jdk6 folder that is independent from the pacman repos.


This was found here


All times are GMT -5. The time now is 11:16 PM.