Currently, get_jvm_env_var will try env[] first before trying to get_line_from_env_file. This could introduce some inconsistent behaviors. For example, if a new system VM is set by emerging a jdk/jre ebuild, running java- config -f (without sourcing /etc/profile first) would still show the old VM or show nothing if the old VM has been unmerged in the process. This is despite what the man pages say: -f --show-active-vm Show the JVM that's currently active, as set via --set-system-vm or --set- user-vm. In my opinion, regardless of whether "env-update && source /etc/profile" has been run, java-config -L/-f should reflect what has been set by -S/-s. It should show the settings that have been set by itself and not worry about the current environment variables. Reproducible: Always Steps to Reproduce: 1. java-config -L [sun-jdk-1.5.0.04] "Sun JDK 1.5.0.04" (/etc/env.d/java/20sun-jdk-1.5.0.04) * [blackdown-jdk-1.4.2.02] "Blackdown JDK 1.4.2.02" (/etc/env.d/java/20blackdown- jdk-1.4.2.02) 2. java-config -S blackdown-jdk-1.4.2.02 3. java-config -f; java -version Actual Results: sun-jdk-1.5.0.04 java version "1.5.0_04" Expected Results: blackdown-jdk-1.4.2.02 java version "1.5.0_04"
Created attachment 65034 [details, diff] proposed patch for jc_util.py
Additionally, with a consistent and self-containing java-config, it would probably be much easier to change the policies specified in bug 9289, comment 7 from 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. to 1) If you merge either a JDK or a JRE, it will be set as the default system VM if none has been set 2) 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. The "regardless" part of current policy #2 is a bit annoying because there are 4 JVMs on my system (sun-jdk 1.4, 1.5, 1.6pre and blackdown-jdk 1.4)
Created attachment 65035 [details, diff] proposed patch for java.eclass
These issues have been addressed with the new Java system.