Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any Java version manager?

I used to have multiple JDK installed on my Linux machine, and I like to switch from one version to another from the command-line ( I used to change my JAVA_HOME manually):

This is my current approach :

I source a ~/.paths in my .bashrc.

the .paths contain all the JDK installed on my machine.

JDK7="~/local/jdk1.7.0_15"
JDK8="~/local/jdk1.8.0"
// I use Jdk 7 by default 
JDK_HOME=$JDK7;     
// including $JDK_HOME/bin to the $PATH

When I want t switch to JDK8, I modify the JDK_HOME variable to point on JDK8 in the file, and I re-source my .paths file.

I know that IDE can manage multiple JDK easily, but I want an rvm like solution.

  • Is there any better trick ?
  • Better more, Is there any equivalent for rvm in Java ?
like image 561
Salah Eddine Taouririt Avatar asked Apr 26 '13 16:04

Salah Eddine Taouririt


1 Answers

There is jdk_switcher although it is quite static to some ubuntu paths - it should be easy to modify it to run from other paths.

There is a plan to make RVM 2 support switching more then just Ruby versions, you can read more about it here.

anyone with the link can comment.

like image 188
mpapis Avatar answered Sep 29 '22 18:09

mpapis