update-alternatives just for one user

5,242

On Debian and derivates, you should probably use update-java-alternatives. Anyway, all those tools are system related, not user related. If you want to use a different java, simply put those lines in your ~/.profile:

JAVA_HOME=/usr/lib/jvm/java-6-sun
JRE_HOME=/usr/lib/jvm/java-6-sun/jre
PATH=$JAVA_HOME/bin:"$PATH"
export JAVA_HOME JRE_HOME
Share:
5,242

Related videos on Youtube

AK4VL
Author by

AK4VL

Updated on September 18, 2022

Comments

  • AK4VL
    AK4VL almost 2 years

    I'm using a shared server. On that server different versions of Java are installed:

      Selection    Path                                      Priority   Status
    ------------------------------------------------------------
      0            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      auto mode
    * 1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manual mode
      2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manual mode
    

    I would like to choose the Second options, but if I tried to do that it complains that I do not have the permissions (I'm not root).

    Is there a way to do that in "user-space"?

    Can the Root user make this preference works only for me?

    • Sam Brightman
      Sam Brightman over 7 years
      The accepted answer is probably preferrable here but if you genuinely need to use your own alternatives see my answer at ServerFault.