update-java-alternatives does not change the JAVA_HOME
Bug #45348 reported by
R. A. Rivas Diaz
This bug affects 4 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
eclipse (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
java-common (Ubuntu) |
Won't Fix
|
Wishlist
|
Unassigned |
Bug Description
java-common define a mechanism to define the variable JAVA_HOME for scripts/packages that require this variable. (could be eclipse, ant...).
The script update-
Changed in java-common (Ubuntu): | |
status: | Invalid → Won't Fix |
To post a comment you must log in.
After thining about this problem, I have arrived to a very simple solution using update- alternatives:
java-common should create the directories:
/etc/java/ home/default/ jdk --> Default JDK HOME home/default/ jre --> Default JRE HOME
/etc/java/
And two for every supported version of java: home/<java version>/jdk --> JDK <java version> HOME home/<java version>/jre --> JRE <java version> HOME
/etc/java/
/etc/java/
For example: home/1. 5/jdk --> JDK 1.5 HOME home/1. 5/jre --> JRE 1.5 HOME home/1. 4/jdk --> JDK 1.4 HOME home/1. 4/jre --> JRE 1.4 HOME
/etc/java/
/etc/java/
/etc/java/
/etc/java/
Every Java Runtime/JDK installed, should update thru update-alteratives, the link to this directories, for example, sun-java5 (which is sadly configured with priority 53) should run after install:
update-alternatives --install /etc/java/ home/default/ jdk java_home_ default_ jdk /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06 53 home/default/ jre java_home_ default_ jre /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06/ jre 53 home/1. 5/jdk java_home_1_5_jdk /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06 53 home/1. 5/jre java_home_1_5_jre /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06/ jre 53 home/default/ jdk java_home_ default_ jdk /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06 53 home/default/ jre java_home_ default_ jre /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06/ jre 53 home/1. 4/jdk java_home_1_4_jdk /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06 53 home/1. 4/jre java_home_1_4_jre /usr/lib/ jvm/java- 1.5.0-sun- 1.5.0.06/ jre 53
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
update-alternatives --install /etc/java/
And the list goes down until java 1.0 or which ever the sun-java5 maintainers consider appropiate.
The same should happen for GCJ equivalent, gcj-compat and gcj-compat-dev
gcj-compat is only a JRE, and claims support for 1.4.2. Currently the priority is set to 1041, so they should run after install:
update-alternatives --install /etc/java/ home/default/ jre java_home_ default_ jre /usr/lib/ jvm/java- 1.4.2-gcj- 4.1-1.4. 2.0/jre 1041 home/1. 4/jre java_home_1_4_jre /usr/lib/ jvm/java- 1.4.2-gcj- 4.1-1.4. 2.0/jre 1041
update-alternatives --install /etc/java/
And gcj-compat-dev, being the JDK complement, should run after install:
update-alternatives --install /etc/java/ home/default/ jdk java_home_ default_ jdk /usr/lib/ jvm/java- 1.4.2-gcj- 4.1-1.4. 2.0 1041 home/1. 4/jdk java_home_1_4_jdk /usr/lib/ jvm/java- 1.4.2-gcj- 4.1-1.4. 2.0 1041
update-alternatives --install /etc/java/
After those steps, the java home will be completelly configurable using update- alternatives. Every package who require a JAVA_HOME JDK, should only point to:
/etc/java/ home/default/ jdk
And if the package requires a java 5 compliant version, the link should be:
/etc/java/ home/1. 5/jdk
The only missing part is for the scripts installed with java-common, that should be updated tu support this structure. update- java-alternativ es should add support for this new entries, and jvm-find.sh should return
JAVA_HOME= /etc/java/ home/default/ jdk
for compatibil...