Language Version Managers - the Developer Parachutes
Tags: node, java, javascript
Published: 2022-09-29 14:47:12

> Installing multiple language versions (e.g. Java 11, Java 19, Java 8 | Node 8, Node 16 | Python 2, Python 3 | etc) on your machine is scary, and not for the faint of heart.
>
> Conquer your fears with the benefit of a developer parachute, by using a Language Version Manager!

As software engineering consultants at [DevObsessed](https://www.devobsessed.com/), we get asked to help with an assortment of various projects – from legacy codebases running in maybe Java 8 or NodeJS 6, to greenfield creations using the newest versions of Java 19 or NodeJS 16. This isn't only an issue between companies though, as most organizations have multiple versions of languages running at any given time too. 

Managing local installations of Java, Node, Python, Ruby, Elixir, etc can be daunting. In the past, trying out the latest version to check for bugs could lead to a developer's machine being down for hours at a time. And if a rollback to a previous version was needed that could take even longer! Wouldn't it be great if you could have a parachute with you on your mission, so that if anything goes wrong you can easily save yourself and proceed with confidence?

Language Version Managers are your answer. Many version managers exist, and in this post we'll show you how Sdkman for Java, and NVM for Node can provide you the courage to easily utilize multiple language versions without any worry in the process.

### Backstory

To set the scene, you should know that originally this post was going to be about the recent release of [Java 19](https://twitter.com/java/status/1572243891562381313). It would be a story about the newest and latest Java features, maybe how to use them, and probably why they would make it great for you to upgrade.

Without thinking about it, using [Sdkman](https://sdkman.io/) with a quick `sdk install java 19-open` and my MacbookPro was running the newest Java within seconds. It was so easy to upgrade to the cutting edge version, that it was summed up easily in a single tweet:

![Tweet of Sdkman installing Java](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lla9ze5jiuapmi0hqnl2.png)
> [https://twitter.com/sheetsj/status/1572298842460286980](https://twitter.com/sheetsj/status/1572298842460286980)

Not until this moment did [I dive in](https://twitter.com/sheetsj/status/1572324247351197696) to see that Java 19 was more of an incremental release. Some bugfixes for sure, but mostly it includes just some [Preview and Incubator features](https://openjdk.org/projects/jdk/19/) (hiding behind feature flags) that won't be fully live until Java 20 or beyond.

So after a few moments of trying out [Gradle](https://twitter.com/sheetsj/status/1572316099030687744) and [IntelliJ](https://twitter.com/sheetsj/status/1572319232096088064) support, I quickly reverted back to my previous Java version with `sdk default java 18.0.2.1-open`. No fuss and no worry. Then it dawned on me how before Sdkman this would have taken me probably many minutes if not hours of work to flip back and forth between Java installation versions locally.

### Sdkman for Java

![Sdkman logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qgyvgnljdlswo66in6n7.png)
>[sdkman.io](https://sdkman.io/)

[Sdkman](https://sdkman.io/) is the best Language Version manager for Java and all JVM languages, to include Groovy, Kotlin, and more. Don't use `brew` or Oracle or some other installer on your macbook. Instead, install Sdkman and use a few commands to manage the version that you use.

- Use the install instructions for Sdkman from [https://sdkman.io/](https://sdkman.io/)
- `sdk ls java` to see the various versions of Java that are available
- `sdk install java 18.0.2.1-open` to install the Java18 OpenJdk version (or [pick your favorite distribution](https://sdkman.io/jdks) from Azul or Microsoft or Amazon, etc)
- The `use` keyword can switch the version for a single shell window, like `sdk use java 19-open`
- The `default` keyword will setup a default for your whole machine, like `sdk default java 18.0.2.1-open`
- Similarly use the same commands for Groovy `sdk ls groovy`, or Kotlin, or [any of the 20+ various JVM languages](https://sdkman.io/sdks)!

### NVM for NodeJS

![Nvm logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8x5e0vkafq516b3qim08.png)
>[https://github.com/nvm-sh/nvm](https://github.com/nvm-sh/nvm)

In the Node world, there are a few options like [NVM](https://github.com/nvm-sh/nvm), [N](https://github.com/tj/n), [FNM](https://github.com/Schniz/fnm), [Volta](https://volta.sh/), and more. I've been a longtime user of NVM, so we'll detail those instructions for use here:

- While unofficially supported, nvm can be installed with [homebrew](https://brew.sh/) using `brew install nvm`
  - Follow any additional instructions to setup your shell in .zsh or .bash_profile or whatever shell you use 
  - Or find other installation instructions at [https://github.com/nvm-sh/nvm#install--update-script](https://github.com/nvm-sh/nvm#install--update-script)
- `nvm ls` to see the available Node versions
- `nvm install --lts` to get the latest stable LTS (Long Term Support) version
- `nvm install v8.17.0` or similar to get a specific version
- `nvm use v8.17.0` or similar to use a specific version in a single shell window
- `nvm alias default v16.17.0` or similar to set a default version

### Wrap-up

There are other various version managers for other languages. Ruby has [rbenv](https://github.com/rbenv/rbenv) or [RVM](https://rvm.io/), Python has [pyenv](https://github.com/pyenv/pyenv), Elixir has [kiex](https://github.com/taylor/kiex), and many more. No matter what language you are on, the key is to find a language installation manager to handle the various versions that you may need to use.

In the Java and Node worlds, Sdkman and Nvm are the parachutes you need for confidence, courage, and to save you from configuration management worry!


![[DevObsesse.com](https://www.devobsessed.com/)](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ebuqyq3pdj69fiaar0y.png)

And if you're looking for the best software engineer consultants for your project or team, developers who average over 10 years of experience, and come with even more tips and tricks that we've learned to improve developer experience over those years -- reach out to us here at DevObsessed! We're obsessed about developer efficiency, and we'll help you achieve your own digital destination!