Bug 461683 - set_javacmd ignores alternatives setting for java
Summary: set_javacmd ignores alternatives setting for java
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: jpackage-utils
Version: 13
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Deepak Bhole
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 498831
TreeView+ depends on / blocked
 
Reported: 2008-09-09 20:25 UTC by Lubomir Rintel
Modified: 2010-05-03 21:24 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-05-03 21:24:21 UTC
Type: ---
Embargoed:


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

Description Lubomir Rintel 2008-09-09 20:25:05 UTC
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 12:18:52 UTC
ping

Comment 2 Deepak Bhole 2008-09-27 17:08:21 UTC
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 11:11:28 UTC
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 09:16:19 UTC
Deepak: Any more opinions or this? Do you think this is the desired behavior?

Comment 5 Bug Zapper 2008-11-26 03:00:51 UTC
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 17:05:11 UTC
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 17:20:58 UTC
(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 17:48:19 UTC
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 21:53:40 UTC
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 09:26:35 UTC
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 12:05:30 UTC
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 15:14:19 UTC
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 21:24:21 UTC
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.