set_javacmd relies on set_jvm setting JAVA_HOME. set_jvm first looks for javac, and in case it is found, the very same directory is used for java. That does not seem correct. See /usr/share/java-utils/java-functions
ping
Based on the comments, it looks for a JDK on the system first, and then falls back to look for JRE. A JDK is guaranteed to have a JRE, so java will always be found once javac is. Are you thinking of a case where java and javac come from different vm's? If so, that case is not supported, as all kinds of things can potentially break...
Fact that JDK is guarranteed to have JRE does not imply it has a preferred JRE. User sets the preferred JRE to use with alternatives. I'm referring to the case user has installed gcj-devel, gcj and openjdk, and wants to use openjdk's java, despite he has gcj javac installed.
Deepak: Any more opinions or this? Do you think this is the desired behavior?
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle. Changing version to '10'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Created attachment 342339 [details] Add option to prefer jre over a sdk IMO for most (all?) end user applications that are run with "java" and don't need the SDK/-devel, the expected thing would be to prefer the newest jre installed on the system. See for example bug 498831. However, changing java-functions to blindly prefer a jre over a sdk would cause backwards compatibility issues. The attached patch could work; by setting JAVA_PREFER_JRE to true/yes/1 one could specify that a jre is preferred. An argument to %jpackage_script is also added for this purpose.
(In reply to comment #6) > Created an attachment (id=342339) [details] > Add option to prefer jre over a sdk ...or perhaps in order to make it clearer that whether to prefer a jre over a sdk is a per app launcher script thing instead of something to set in user environments, a better name for the JAVA_PREFER_JRE env variable would be something like _java_prefer_jre or just _prefer_jre.
Created attachment 354373 [details] Add option to prefer jre over a sdk, take #2 Revised patch, using _prefer_jre instead of JAVA_PREFER_JRE as discussed. Any thoughts/news/ETA on this?
Ping? Actually I'd personally prefer functionality like "Give me a JRE >= 1.6.0" or "Gimme a full JDK >= x.x.x" but that would mean much larger changes to jpackage-utils and the patch in comment 8 would be a decent stopgap if you ask me. It is not 100% backwards compatible though; just sourcing java-functions would no longer set a JAVA_HOME.
This bug appears to have been reported against 'rawhide' during the Fedora 12 development cycle. Changing version to '12'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
This bug appears to have been reported against 'rawhide' during the Fedora 13 development cycle. Changing version to '13'. More information and reason for this action is here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping
I just hit this problem today, when my program requires java >= 1.6, and OpenJDK is installed but java-1.5.0-gcj-devel happens to also be installed. In this case, java 1.5 is run.
Though I agree that jre should be preferred over jdk, there are too many potential compatibility issues that this would bring up. Given that there have been very few reports regarding this, I think Ville's approach (Comment #8) is a good stopgap measure. I have committed the changes and built it in rawhide. Thanks for the patch!