You are not logged in.

#1 2011-12-15 15:26:11

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Installing openJDK 7 and Oracle JDK 6 side-by-side

I have a working jre6 + jdk6 installation from the AUR; I need these for some enterprise software I run. However, I do want to start migrating to the openJDK 7 for new development projects.

The problem is that while one "should" be able to run multiple versions of the JDK on a machine, both the AUR jre6 and the jre7-openjdk package in "extra" provide "java-runtime" which causes pacman to report a conflict.

As far as I can tell, the only conflicting files between the jre6 / jre7-openjdk and jdk6 / jdk7-openjdk are the following:

etc/profile.d/jre.csh
etc/profile.d/jre.sh

and

etc/profile.d/jdk.csh
etc/profile.d/jdk.sh

Does anyone know if this is correct? If so, I would back up these files, install jre7-openjdk + jdk7-openjdk with the --force option and then restore the files; that way my "default" JDK should be jdk6, while I can use the JDK 7 by simply configuring Eclipse/Geronimo, etc. to point to the JDK7 folder.

Offline

#2 2011-12-15 16:15:47

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Installing openJDK 7 and Oracle JDK 6 side-by-side

Alright - I didn't realize what kind of a hornet's nest this is going to be. It turns out you cannot force Pacman to install a package that "provides" the same thing ("java-runtime"). Probably for good reason, but in this case, that's a pain.

I can see a couple of options 1) use the AUR to install JRE 7/ JDK 7, but that will probably throw the same "provides" error. 2) Remove my current AUR JRE/JDK 6, then install AUR fake-java and install both JDK 6 and 7 directly from download from Oracle. Or 3) download JDK7 from Oracle and extract it manually. I'm doing 3), since that should not mess with the package database at all.

Offline

#3 2011-12-15 16:21:43

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Installing openJDK 7 and Oracle JDK 6 side-by-side

You can edit the PKGBUILD and remove the 'provides' or 'conflicts' parts.

Offline

#4 2011-12-15 18:43:07

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Installing openJDK 7 and Oracle JDK 6 side-by-side

Alright - here's what I ended up doing - PLEASE NOTE that this may completely trash your Java install, so only do this is if you know what you're doing:

Adding JDK7-OpenJDK to an existing JDK6 install, keeping the JDK6 install as the "normal" one:

1. Rename /etc/profile.d/jre.csh to /etc/profile.d/jre.csh.bak
2. Rename /etc/profile.d/jdk.sh to /etc/profile.d/jdk.sh.bak
3. Download, but not instal JRE7 openJDK from http://www.archlinux.org/packages/extra … /download/ (for 64bit)
4. Download, but not instal  JDK7openJDK from http://www.archlinux.org/packages/extra … /download/ (for 64bit)

So far so good - no real irreversible harm done, the next steps are where we "hack" the packages, so from here on, be aware.

5. Extract the .PKGINFO file from the jre7-openjdk.xxxx.pkg.tar.xz
6. Edit the file and change the following lines (removing any entries after the = , but do not remove the lines themselves:
conflict =
provides =
7. Re-add the now changed .PKGINFO back to the jdk7-openjdk.xxxx.pkg.tar.xz file (I use Ark) - be patient, this takes a while
8. Install the modified package with the "force" option:
pacman -Uf jre7-openjdk-7.xxx-x86_64.pkg.tar.xz

9. Repeat these steps for the jdk7-openjdk.xxxx.pkg.tar.xz package

10. Rename /etc/profile.d/jre.csh to /etc/profile.d/jre.csh.jdk7
11. Rename /etc/profile.d/jdk.sh to /etc/profile.d/jdk.sh.jdk7

12. Rename /etc/profile.d/jre.csh.bak to /etc/profile.d/jre.csh
13. Rename /etc/profile.d/jdk.sh.bak to /etc/profile.d/jdk.sh

Last steps are to remove the symbolic links that the jdk-openjdk package creates in the /usr/bin folder. Otherwise, the PATH entry will always pick up those JDK7 files and your default JVM will be 7 (which is not what I wanted):

Once again, don't run these commands unless you know what you're doing:
rm -f /usr/bin/appletviewer
rm -f /usr/bin/apt
rm -f /usr/bin/extcheck
rm -f /usr/bin/idlj
rm -f /usr/bin/jar
rm -f /usr/bin/jarsigner
rm -f /usr/bin/javac
rm -f /usr/bin/javadoc
rm -f /usr/bin/javah
rm -f /usr/bin/javap
rm -f /usr/bin/jconsole
rm -f /usr/bin/jdb
rm -f /usr/bin/jhat
rm -f /usr/bin/jinfo
rm -f /usr/bin/jmap
rm -f /usr/bin/jps
rm -f /usr/bin/jrunscript
rm -f /usr/bin/jsadebugd
rm -f /usr/bin/jstack
rm -f /usr/bin/jstat
rm -f /usr/bin/jstatd
rm -f /usr/bin/native2ascii
rm -f /usr/bin/rmic
rm -f /usr/bin/schemagen
rm -f /usr/bin/serialver
rm -f /usr/bin/wsgen
rm -f /usr/bin/wsimport
rm -f /usr/bin/xjc
rm -f /usr/bin/java

Last edited by twelveeighty (2011-12-15 21:32:03)

Offline

#5 2011-12-19 23:19:42

twelveeighty
Member
From: Alberta, Canada
Registered: 2011-09-04
Posts: 1,096

Re: Installing openJDK 7 and Oracle JDK 6 side-by-side

Alright - after all this trouble, this is just a BAD idea, since a "pacman -Syu" will simply report the same problem and you are forced to uninstall jdk6.

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.

Offline

Board footer

Powered by FluxBB