Bug ID 1043388
Summary Java variables have to be set much better
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Java
Assignee bnc-team-java@forge.provo.novell.com
Reporter mmrmartin@gmail.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

Today openSUSE uses `/etc/profile.d/alljava.sh` for setting Java variables. It
doesn't follow `update-alternatives` script and worse the variables use the
oldest Java  I have (like Java 1.5, otherwise I have Java 1.8 and even OpenJDK
1.8 on my computer). It breaks many apps and also it is security issue as well.

$ echo $JAVA_HOME
/usr/lib64/jvm/java-1.5.0
$ echo $JAVA_ROOT
/usr/lib64/jvm/java-1.5.0
$ echo $JAVA_BINDIR
/usr/lib64/jvm/java-1.5.0/bin
$ echo $JDK_HOME
/usr/lib64/jvm/java-1.5.0
$ echo $SDK_HOME
/usr/lib64/jvm/java-1.5.0

$ ls /usr/java
default  jdk1.8.0_121  latest

$ ls /usr/lib64/jvm/
java-1.5.0      java-1.5.0-gcj-6-1.5.0.0  java-gcj   jre-1.5.0-gcj 
jre-1.8.0-openjdk  jre-openjdk
java-1.5.0-gcj  java-1.8.0-openjdk-1.8.0  jre-1.5.0  jre-1.8.0      jre-gcj

I think it would be nice if `alljava.sh` could have some settings in
update_alternatives or if it could just export JAVA_HOME from `$ type java` and
JDK_HOME from `$ type javac`

$ update-alternatives --all
...
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                       Priority   Status
------------------------------------------------------------
* 0            /usr/java/latest/bin/java                   2000      auto mode
  1            /usr/java/latest/bin/java                   2000      manual
mode
  2            /usr/lib64/jvm/jre-1.5.0-gcj/bin/java       1505      manual
mode
  3            /usr/lib64/jvm/jre-1.8.0-openjdk/bin/java   1805      manual
mode

Press <enter> to keep the current choice[*], or type selection number: 
There are 2 choices for the alternative javac (providing /usr/bin/javac).

  Selection    Path                                     Priority   Status
------------------------------------------------------------
* 0            /usr/java/latest/bin/javac                2000      auto mode
  1            /usr/java/latest/bin/javac                2000      manual mode
  2            /usr/lib64/jvm/java-1.5.0-gcj/bin/javac   1505      manual mode
...

I can set alternatives for `/usr/bin/java-1.5.0`, but the only solution is
point it to `/usr/java/jdk1.8.0_121` and that's bad because of version
mismatch.

Why don't we even have java or javac as a link to another linked directory,
like:
# Binary level
java -> /usr/lib64/jvm/jre/bin/java
javac -> /usr/lib64/jvm/jdk/bin/java
# Java version level
/usr/lib64/jvm/jre -> /usr/lib64/jvm/jre_1.8.0
/usr/lib64/jvm/jdk -> /usr/lib64/jvm/jdk_1.8.0
# Java version implementation level
/usr/lib64/jvm/jre_1.8.0 -> /usr/lib64/jvm/jre-1.8.0-openjdk (or
/usr/java/lastest for me :-) )
/usr/lib64/jvm/jdk_1.8.0 -> /usr/lib64/jvm/java-1.8.0-openjdk (or
/usr/java/lastest for me :-) )
Than JAVA_HOME could be simply set to `/usr/lib64/jvm/jre` and JDK_HOME to
`/usr/lib64/jvm/jdk` and all could be done by update-alternatives.


You are receiving this mail because: