Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 9289 - blackdown-jdk should overwrite env of blackdown-jre
Summary: blackdown-jdk should overwrite env of blackdown-jre
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-10-18 06:11 UTC by J Robert Ray
Modified: 2004-06-03 12:46 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description J Robert Ray 2002-10-18 06:11:17 UTC
blackdown-jdk offers a superset of what is available in blackdown-jre, but if
jre is already installed at the time that jdk gets installed, java-config is not
used to change the default VM and switch the java env variables over to jdk.

A side-effect of this is after installing jdk, tools such as 'jar' are not
automatically placed in $PATH.  When blackdown-jdk gets installed because it is
a dependency of a package that requires 'jar', in effect it does not meet that
dependency until the user manually runs java-config.

Perhaps the blackdown-jdk ebuild should run java-config even if a default VM is
set, if the current VM is blackdown-jre.
Comment 1 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2002-10-18 16:07:56 UTC
It's sadly a bit trickier than that. If a user installs blackdown-jre, then
installs blackdown-jdk, it may make sense to say that the blackdown-jdk will
take precedence. But when the user then unmerges blackdown-jdk, the system
should revert to blackdown-jre, which is impossible if the env files are
actually overwritten.

Next up: The user installs sun-jdk, then installs blackdown-jdk, should the
blackdown-jdk then take precedence as the system-default from the moment it was
installed ?

In general, we have opted for _NOT_ modifying a users enviroment and settings
unless he explicitly asks for it. The only exception is setting a default VM (a
JRE or a JDK) if you install one and none exist beforehand.

Please add your insights; I'll keep pondering this until we get to a solution
that's good.
Comment 2 J Robert Ray 2002-10-18 16:32:46 UTC
In my opinion a merge should be more troublefree than an unmerge.  It makes
sense to me for a user to have to run 'java-config' to change to a different VM
once she has removed a package.

But in my example where I have installed blackdown-jdk and afterwards 'jar' is
not in my path, this is confusing.  The ebuild could at least suggest to me to
run java-config after installing the package, to set things straight.  I didn't
discover I needed to do this until after I started looking around in
/etc/env.d/20java.

As for env files being overwritten, I see there would be a problem if the user
modifies /etc/env.d/20java.  This file could have stronger language suggesting
the user customize the files in /etc/env.d/java and then rerun java-config. 
Assuming the user has customized the blackdown-jre file, and assuming when
blackdown-jdk is installed the env is switched to it, the user's changes are
still intact and he can switch back to blackdown-jre with no harm done.

I'm suggesting auto-switching the VM only on a blackdown jre->jdk upgrade, and
not when installing any jdk.

But really the problem I'm pointing out is 'jar' not being added to the path,
making my merge fail.  There could be other ways of addressing that problem.
Comment 3 David Cozatt 2002-12-04 22:29:20 UTC
Have blackdown-jre merged and working wanted to use/try openoffice
which requires blackdown-jdk. So tried to emerge after openoffice failed 
the installation and setting of the vm failed as it was not able to find the jdk
after the merge. java-config will not find the jdk. --list-available-vms
only lists the jre. yet I can browse the directories in /opt/blackdown-jdk-1.3.1
and see the files? 
Essentially the emerge of the jdk attempted to -set-system-vm=blackdown-jdk and
failed.the error was not found.
Comment 4 Jason Stubbs (RETIRED) gentoo-dev 2004-01-07 22:56:04 UTC
Not sure if anybody's still looking at this, but...

How about splitting the Java env files into two: 20*-jre and 21*-jdk. Could then modify java-config to set either or both to none, still giving the user full configuration. Emerging or unmerging a jdk/jre could then call java-config to set defaults in the following manner for a jre:

1. If unmerging a jre,
1.a. If the current jre is none or the current jre is not the jre that has been unmerged, do nothing.
1.b. Else if there is a jdk configured or no other jres are installed, set the current jre to none.
1.c. Else set the current jre to the next "default" jre.
2. Else if merging a jre,
2.a. If the current jre is not none, do nothing.
2.b. Else set the current jre to the jre that has been emerged.

and similarly for a jdk:

1. If unmerging a jdk,
1.a. If the current jdk is none or the current jdk is not the jdk that has been unmerged, do nothing.
1.b. Else if no other jdks are installed, set the current jdk to none.
1.c. Else set the current jdk to the next "default" jdk.
2. Else if merging a jdk,
2.a. If the current jdk is not none, do nothing.
2.b. Else set the current jdk to the jdk that has been emerged.

With this method (or a variant thereof), java should always be available unless the user has explicitly set either the jre or jdk to none.

What constitutes the "default" jre/jdk could be controversial, but is not too important as the user must have installed the software first anyway. I would suggest that it be easiest to just go alphabetically.
Comment 5 Collin Starkweather 2004-02-29 09:32:06 UTC
It's been quite some time since anyone looked at this.  I think it is worth another look.

I am suffering the same quandry because I merged blackdown-jdk, then blackdown-jre, then tried to merge openoffice.  No luck because it can't find javac, which is in /opt/blackdown-jdk-1.4.x whereas it tries to find it in /opt/blackdown-jre-1.4.x.  If I take out the java USE flag from /etc/make.conf, I believe it will build just fine, but I see javac in /opt/blackdown-jdk-1.4.1/bin and I want to build openoffice with java support, dagnabbit.
Comment 6 Collin Starkweather 2004-02-29 09:42:26 UTC
P.S.  I know I can java-config --set-system-vm=blackdown-1.4.1 to get openoffice to find javac ... but I'm presenting the quandry from the perspective of joe user.
Comment 7 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-06-03 09:47:39 UTC
I think we'll adopt a middle ground here for now:

1) If you merge a JRE and a JDK is already present, we'll keep the 
   JDK as the default system VM.
2) If you merge a JDK, it will be set as the default system VM regardless
3) If you unmerge either a JDK or a JRE, a big fat warning will tell you
   to run java-config manually to select your preferred VM.
Comment 8 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-06-03 12:33:40 UTC
Fixed this for blackdown-jre, sun-jre-bin, ibm-jre-bin and compaq-jre.
Comment 9 Karl Trygve Kalleberg (RETIRED) gentoo-dev 2004-06-03 12:46:39 UTC
I've added the suggestions to the upcoming Java Ebuild Development Guide, so
I consider this matter closed, or at least superseded by the Guide.