The java-config utility does not set the user-specified java vm correctly. Example: In one terminal, I did this: mikeh@tardis mikeh $ java-config --set-user-vm=sun-jdk-1.3.1.06 Now using Sun JDK 1.3.1.06 (/etc/env.d/java/20sun-jdk-1.3.1.06) I opened another session, logged in as 'mikeh', and did this: mikeh@tardis mikeh $ echo $JAVA_HOME /opt/sun-jdk-1.3.1.06 mikeh@tardis mikeh $ which java /opt/blackdown-jdk-1.3.1/bin/java So $JAVA_HOME is set correctly, but 'java' will run from /opt/blackdown-jdk (the system-wide default). The problem is this line in ~/.gentoo/java-env: PATH=${PATH}:/opt/sun-jdk-1.3.1.06/bin:/opt/sun-jdk-1.3.1.06/jre/bin It should put the new java path in the front, since /opt/blackdown-jdk is set as the path in /etc/profile.env (since it's the system-wide path)
Have you run: $ env-update $ source /etc/profile Otherwise the scirpts in /etc/env.d won't point to the new jvm you want to use
You should run env-update after java-config --set-user-vm=xx and login again.
I have the same problem as mikeh. Although this bug should be resolved for years it seems that it isnt. I have 3 jdks installed and have chosen sun-jdk-1.4.2.04 as the system VM. when i logon as regular user, change to to blackdown-jdk-1.4.1 or sun-jdk-1.5.0, su to root and run env-update and then relog as user the jdk is not changed. The file ~/.gentoo/java was updated and shows the correct entries but it is somehow not integrated into the shell (bash btw)
You must manually add ~/.gentoo/java to the end of your .bashrc: [ -f $HOME/gentoo/java ] && source $HOME/.gentoo/java
This bug is still open? A clearer fix would be to make the Java executable JAVA_HOME/bin/java. IOW: JAVA_HOME=/path/to/jdk PATH=$PATH:$JAVA_HOME/bin