Arch Linux

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!
Tasklist

FS#10130 - JAVA_HOME env variable with JDK and JRE

Attached to Project: Arch Linux
Opened by Denis A. Altoe Falqueto (denisfalqueto) - Wednesday, 09 April 2008, 01:53 GMT
Last edited by Eduardo Romero (kensai) - Friday, 04 July 2008, 16:21 GMT
Task Type Feature Request
Category Packages: Extra
Status Closed
Assigned To Jason Chu (jason)
Eduardo Romero (kensai)
Architecture All
Severity Medium
Priority Normal
Reported Version 2007.08-2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 3
Private No

Details

Description:

Hi,

As it is today, the $JAVA_HOME environment variable is pointed to the jre directory. This is fine when someone just installs the jre package. But if you install the jdk, this variable is very important for lots of java development tools, so it should point to the jdk directory. Nevertheless, as the jre.sh script in /etc/profile.d is executed after the jdk.sh (probably because of the ordering of the names), this variable is allways reset by jre.sh, even if we changed jdk.sh to configure that variable.

So, it would be very good if the jre.sh script was smart enough to set $JAVA_HOME to the jdk directory in case the jdk package was installed. Maybe it could check the existence of $J2SDKDIR that is set up by jdk.sh.

A possible solution could be:

---8<----- /etc/profile.d/jre.sh ---- 8<----
if [ -z $J2SDKDIR ] ; then
export J2REDIR=/opt/java/jre
export PATH=$PATH:$J2REDIR/bin
export CLASSPATH=$CLASSPATH:$J2REDIR/lib
else
export J2REDIR=$J2SDKDIR
fi
export JAVA_HOME=$J2REDIR
---8<----- /etc/profile.d/jre.sh ---- 8<----

So it checks to see if $J2SDKDIR is set before setting the jre specific variables. Otherwise, it points $J2REDIR to $J2SDKDIR and points $JAVA_HOME allways to the right place.
This task depends upon

Closed by  Eduardo Romero (kensai)
Friday, 04 July 2008, 16:21 GMT
Reason for closing:  Implemented
Additional comments about closing:  Implemented on the latest 6u6 upgrade of the jre and jdk package.
Comment by Denis A. Altoe Falqueto (denisfalqueto) - Wednesday, 09 April 2008, 01:54 GMT
It broke my indentation... there should be some tabs between then and else and fi, but you got the point.
Comment by Jason Chu (jason) - Monday, 12 May 2008, 04:33 GMT
I changed this is 6u5 because of #9961. If you tell me this guy doesn't know what he's talking about, I'll change it back.
Comment by Denis A. Altoe Falqueto (denisfalqueto) - Tuesday, 13 May 2008, 01:30 GMT
I've been using the above configuration since when I opened this issue and I don't have any problems with java programs or applets. Even my bank's site works fine.

Nevertheless, I looked over the jre's bin directory and found that it is a subset of the jdk's bin directory, with just one file absent: java_vm, which is in jre but not in jdk. It seems to be involved with starting the java plugin, but It is started even if not in the PATH, so I think it is not important in the jdk's bin dir.

The other files in jdk's bin are all symlinks to the jre, so there is not any problem in using the JDK when it is available. Moreover, there are some tools (Grails, for instance) which need some programs that are not in the JRE's dir. So I suggest you change it back. I can't see any worth point in keeping it this way.
Comment by Vitaliy Berdinskikh (skipper13) - Monday, 23 June 2008, 05:43 GMT
I can't build libmatthew-java because JAVA_HOME point into JRE folder.

I think if JDK's installed JAVA_HOME must to point into JDK folder.

Loading...