Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#41662 - [java-common] JAVA_HOME should point to /usr/lib/jvm/java-default-runtime/jre -uncomplete bin links
Attached to Project:
Arch Linux
Opened by Javier (jevv) - Saturday, 23 August 2014, 06:19 GMT
Last edited by Guillaume ALAUX (galaux) - Tuesday, 26 August 2014, 19:10 GMT
Opened by Javier (jevv) - Saturday, 23 August 2014, 06:19 GMT
Last edited by Guillaume ALAUX (galaux) - Tuesday, 26 August 2014, 19:10 GMT
|
DetailsDescription:
Currently on /etc/profile.d/jre.sh and /etc/profile.d/jre.csh, JAVA_HOME points to: /usr/lib/jvm/java-default-runtime If only the openJDK JRE is installed that works quiet well, given one does: archlinux-java set java-[78]-openjdk/jre And then that's it. The bin links generated are only the ones on java-[78]-openjdk/jre/bin, which is OK, because only the JRE is installed. But when the openJDK JDK is installed, and by doing: archlinux-java set java-[78]-openjdk/jre ONLY the java-[78]-openjdk/jre/bin links are generated again, missing the ones on the JDK, the java-[78]-openjdk/bin ones. Notice, by doing: archlinux-java fix Then the bin links get generated corrected, as if one would have run instead: archlinux-java set java-[78]-openjdk Which means to me, when installing the JDK, one should really set java to the JDK path, and NOT the JRE path, which is done correctly by: archlinux-java fix The problem is that by using "fix" instead of "set", or by "setting" to the JDK instead of the JRE, though the links are generated correctly and as expected, that leaves JAVA_HOME incorect, given JAVA_HOME must point to the JRE. It seems to me whether one installs the JRE only or the JDK, the path java-[78]-openjdk/jre will always exist, and therefore, if one always "sets" archlinux-java to java-[78]-openjdk without "/jre", then things will always work. So I think all needing fixing is the sh and csh profiles, so that JAVA_HOME always points to java-default-runtime/jre, and when doing so, changing also install_java-common.sh, so that java-default-runtime/jre is also changed there, as well as any other message generator indicating set should be done with java-[78]-openjdk/jre, given it should be java-[78]-openjdk instead for things to work with JDK and JRE both, and of course the documentation on: https://wiki.archlinux.org/index.php/java should be changed accordingly. All that so that JAVA_HOME points to java-default-runtime/jre, java-default-runtime points to java-[78]-openjdk, and the links are correctly generated for the JDK when present. This can be better explained as follows: ++++++++++++++ If: % sudo archlinux-java fix Then: % archlinux-java status Available Java environments: java-8-openjdk (default) % ls -l /usr/bin/java* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/java -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/javac -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/javadoc -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/javah -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/javap -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 28 Aug 23 00:05 /usr/bin/java-rmi.cgi -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 33 Aug 21 15:30 /usr/bin/javaws -> /usr/share/icedtea-web/bin/javaws* But we get the wrong JRE: % echo $JAVA_HOME /usr/lib/jvm/java-default-runtime % ls -l /usr/lib/jvm/java-default-runtime lrwxrwxrwx 1 root root 14 Aug 22 23:41 /usr/lib/jvm/java-default-runtime -> java-8-openjdk It should have been instead: /usr/lib/jvm/java-default-runtime/jre ++++++++++++++ If: % sudo archlinux-java set java-8-openjdk/jre Then we get the weird status: % archlinux-java status Available Java environments: java-8-openjdk % ls -l /usr/bin/java* lrwxrwxrwx 1 root root 28 Aug 23 00:08 /usr/bin/java -> /usr/lib/java-common-wrapper* lrwxrwxrwx 1 root root 33 Aug 21 15:30 /usr/bin/javaws -> /usr/share/icedtea-web/bin/javaws* weird because it doesn't indicate a default java. But most importantly, we don't get the JDK bin links, only a couple of JRE ones. Which is obviousl wrong. Of course we get the right JRE: % echo $JAVA_HOME /usr/lib/jvm/java-default-runtime % ls -l /usr/lib/jvm/java-default-runtime lrwxrwxrwx 1 root root 18 Aug 23 00:08 /usr/lib/jvm/java-default-runtime -> java-8-openjdk/jre When no matter if JRE only or JDK, both would have worked OK with java-default-runtime -> java-8-openjdk if JAVA_HOME had ponted to java-default-runtime/jre instead. ++++++++++++++ One more thing, :-) Instead of calling the link java-default-runtime, if following the recommended fix, then I would call it java-default instead. Additional info: * package version(s) % pacman -Qs openjdk local/jdk8-openjdk 8.u20-1 local/jre8-openjdk 8.u20-1 local/jre8-openjdk-headless 8.u20-1 % pacman -Qs icedtea-web local/icedtea-web 1.5.1-1 * config and/or log files etc. % grep JAVA_HOME /etc/profile.d/jre.*sh /etc/profile.d/jre.csh:setenv JAVA_HOME "/usr/lib/jvm/java-default-runtime" /etc/profile.d/jre.sh:export JAVA_HOME=/usr/lib/jvm/java-default-runtime Steps to reproduce: |
This task depends upon
Closed by Guillaume ALAUX (galaux)
Tuesday, 26 August 2014, 19:10 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in java-common 1-6
Tuesday, 26 August 2014, 19:10 GMT
Reason for closing: Fixed
Additional comments about closing: Fixed in java-common 1-6
JAVA_HOME is not meant to point at a "JRE only" dir but at a valid JVM install dir, be it a JDK or a JRE. So if you have packages jre8-openjdk, jre8-openjdk-headless and jdk8-openjdk installed, then the following values are as expected:
% echo $JAVA_HOME
/usr/lib/jvm/java-default-runtime
% ls -l /usr/lib/jvm/java-default-runtime
lrwxrwxrwx 1 root root 14 Aug 22 23:41 /usr/lib/jvm/java-default-runtime -> java-8-openjdk
About the weird status, I do agree this is a bug:
% sudo archlinux-java set java-8-openjdk/jre
% archlinux-java status
Available Java environments:
java-8-openjdk # I will make it report the corresponding "/jre" is setup as default
> But most importantly, we don't get the JDK bin links, only a couple of JRE ones. Which is obviousl wrong.
You specified you wanted the JRE to be setup as default with "archlinux-java set java-8-openjdk/jre". Then only the JRE binaries are linked. If you wanted the whole JDK to be setup as default, you should have issued "archlinux-java set java-8-openjdk"
So, I see for binaries JDK/bin includes the stuff JRE/bin includes, so no issues there, however JRE/lib includes stuff not in JDK/lib:
% ls /usr/lib/jvm/java-8-openjdk/jre/lib
amd64/ classlist ext/ jce.jar logging.properties@ net.properties@ rt.jar
applet/ cmm/ flavormap.properties@ jexec* management/ psfontj2d.properties@ security/
calendars.properties@ content-types.properties@ hijrah-config-umalqura.properties jsse.jar management-agent.jar psfont.properties.ja@ sound.properties@
charsets.jar currency.data
% ls /usr/lib/jvm/java-8-openjdk/lib
amd64/ ct.sym dt.jar ir.idl jconsole.jar jexec* orb.idl sa-jdi.jar tools.jar
Including "applet" dir, and rt.jar. Perhaps java looks for that stuff whether in JAVA_HOME or JAVA_HOME/jre any ways, :-) If that is the case, I didn't know that. I always set before JAVA_HOME to JDK/jre.
I'll leave JAVA_HOME pointing where it was pointing, java-default-runtime, and run "archlinux-java fix"
Thanks,
Javier
% archlinux-java status
Available Java environments:
java-7-openjdk
java-8-openjdk (java-8-openjdk/jre default)
Thanks!