RVM-like Tool for Java

I'm looking for a tool that will allow me to switch an executable Java implementation such as Ruby RVM (or RBENV). I know that Debian systems provide an alternative mechanism, and I can manually set JAVA_HOME.

However, I would like for something to be more automatic, if possible. If he can get the JDK, which will be even better, but not needed.

I searched, but did not see anything like it. My guess is that the Java ecosystem is used to using this functionality in the IDE.

Edit: changing PATH and JAVA_HOME seems to work fine. It can be trivially automated.

+5
source share
3 answers

I think there is no such tool. Each platform has its own systems. Debian / Ubuntu, RedHat / CentOS, and SLE / OpenSUSE (perhaps some other distributions) use an alternative mechanism. Mac OSX has its own switching mechanism for changing the current JVM in use.

I need to support many workstations and developer servers. All * based on nix (OSX, Linux, Solaris) and used to install all JVMs in the directory and create a symbolic link CURRENT to the version that should be used. The variable JAVA_HOME and PATH points to this symbolic link CURRENT. If Ia wants to use another version only haf to move the symbolic link CURRENT. No further action is required.

Unfortunately, this approach does not work for Windows-based systems.

+2
source

There is jenv based on Ruby RVM.

To add new versions of Java you need to go through several steps, but as soon as they appear, you can switch between them using jenv use java $version . It also processes Java applications for specific versions of Java.

There is also another tool there that I did not use, vaguely also called jenv , but based on Ruby rbenv.

† The issue with adding Java versions seems to be related to Oracle, possibly licensing issues, and seems to apply to both tools.

+4
source

For those looking for such a tool in 2016, try jabba . It was designed after nvm / gvm / rvm (in fact, the CLI is almost identical to one of the nvm).

 jabba install 1.8 # "jabba use 1.8" will be called automatically jabba ls # list all installed jdk's jabba use 1.6 # switch to a different version of jdk 

Full disclosure: I support the project.

+2
source

Source: https://habr.com/ru/post/943728/


All Articles