Bug 461683 - set_javacmd ignores alternatives setting for java
set_javacmd ignores alternatives setting for java
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: jpackage-utils (Show other bugs)
13
All Linux
medium Severity medium
: ---
: ---
Assigned To: Deepak Bhole
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 498831
  Show dependency treegraph
 
Reported: 2008-09-09 16:25 EDT by Lubomir Rintel
Modified: 2010-05-03 17:24 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-05-03 17:24:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Add option to prefer jre over a sdk (2.37 KB, patch)
2009-05-04 13:05 EDT, Ville Skyttä
no flags Details | Diff
Add option to prefer jre over a sdk, take #2 (2.36 KB, patch)
2009-07-20 13:48 EDT, Ville Skyttä
no flags Details | Diff

  None (edit)
Description Lubomir Rintel 2008-09-09 16:25:05 EDT
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
Comment 1 Lubomir Rintel 2008-09-27 08:18:52 EDT
ping
Comment 2 Deepak Bhole 2008-09-27 13:08:21 EDT
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...
Comment 3 Lubomir Rintel 2008-09-28 07:11:28 EDT
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.
Comment 4 Lubomir Rintel 2008-10-27 05:16:19 EDT
Deepak: Any more opinions or this? Do you think this is the desired behavior?
Comment 5 Bug Zapper 2008-11-25 22:00:51 EST
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
Comment 6 Ville Skyttä 2009-05-04 13:05:11 EDT
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.
Comment 7 Ville Skyttä 2009-05-04 13:20:58 EDT
(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.
Comment 8 Ville Skyttä 2009-07-20 13:48:19 EDT
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?
Comment 9 Ville Skyttä 2009-11-12 16:53:40 EST
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.
Comment 10 Bug Zapper 2009-11-16 04:26:35 EST
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
Comment 11 Bug Zapper 2010-03-15 08:05:30 EDT
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
Comment 12 Adam Goode 2010-04-30 11:14:19 EDT
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.
Comment 13 Deepak Bhole 2010-05-03 17:24:21 EDT
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!

Note You need to log in before you can comment on or make changes to this bug.