# How to install multiple Java versions?

**URL:** <https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486>\
**Category:** General Questions/Help\
**Tags:** openjdk, java\
**Created:** [1 March 2021 13:54 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486 "2021-03-01T13:54:45Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [1 March 2021 13:54 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/1 "2021-03-01T13:54:45Z")

</div>

The version of Java installed with Android Studio on my Mac is the following (when I run `java -version`)

```auto
openjdk version "1.8.0_242-release"
OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
OpenJDK 64-Bit Server VM (build 25.242-b3-6915495, mixed mode)

```

An hour later I’m taking an online class and one of the prerequisites is `OpenJDK 11`.  
How do I install both of the versions side by side on my Mac if I don’t have ASDF.

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [1 March 2021 14:37 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/3 "2021-03-01T14:37:13Z")

</div>

As I’m using IntelliJ IDEA and while creating a new project one can choose which version of Java they wanna use, so the problem is solved.  
I’m not a regular user of Jetbrains tools and often use only code editors, so I didn’t know that I can choose a Java version during the project creation step.

---

<div class="post-metadata">

**Author:** ![AstonJ](https://forum.devtalk.com/user_avatar/forum.devtalk.com/astonj/32/7_2.png) [@AstonJ](https://forum.devtalk.com/u/AstonJ)\
**Post date:** [1 March 2021 14:55 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/4 "2021-03-01T14:55:11Z")

</div>

I was going to ping @finner to see if he could help but looks like you sorted it 🤓

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [1 March 2021 18:50 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/5 "2021-03-01T18:50:22Z")

</div>

Yes. Thank you! 🙂

---

<div class="post-metadata">

**Author:** ![finner](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/f/a4c791/32.png) [@finner](https://forum.devtalk.com/u/finner)\
**Post date:** [1 March 2021 21:03 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/6 "2021-03-01T21:03:23Z")

</div>

hi @DevotionGeo - I now use [sdkman](https://sdkman.io/) to switch through my Java versions.  
Here is the [usage](https://sdkman.io/usage) page.  
On a mac the java sdks will be installed :

`/Users/<you>/.sdkman/candidates/java/`

In my case I have the following

`/Users/<user>/.sdkman/candidates/java/11.0.2-open`  
`/Users/<user>/.sdkman/candidates/java/12.0.2.j9-adpt`  
`/Users/<user>/.sdkman/candidates/java/15.0.2.j9-adpt`  
`current -> /Users/<user>/.sdkman/candidates/java/11.0.2-open`

_current_ is a symbolic link which points to the version you are currently using, so from inside an IDE you would have to point to the real folder.

Not sure of that helps you at this stage.

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [2 March 2021 06:14 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/7 "2021-03-02T06:14:17Z")

</div>

Thank you so much @finner!

Do you recommend using `asdf` for managing Java versions on Mac ?

---

<div class="post-metadata">

**Author:** ![finner](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/f/a4c791/32.png) [@finner](https://forum.devtalk.com/u/finner)\
**Post date:** [3 March 2021 12:39 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/8 "2021-03-03T12:39:22Z")

</div>

hi @DevotionGeo - I’ve never even heard of `asdf` before 😊  
From what I can see about `asdf` it manages multiple languages, if you are constantly switching between languages and then versions within those languages then maybe `asdf` will work well for you. But as I’ve said, I have never used it.  
If you do decide to use it let me know what you think.

---

<div class="post-metadata">

**Author:** ![DevotionGeo](https://forum.devtalk.com/user_avatar/forum.devtalk.com/devotiongeo/32/1140_2.png) [@DevotionGeo](https://forum.devtalk.com/u/DevotionGeo)\
**Post date:** [3 March 2021 19:27 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/9 "2021-03-03T19:27:08Z")

</div>

Actually I’ve used `asdf` before in Ubuntu, and I’ve liked it. But once when I was trying to make Quarkus work with an `asdf` installed Java, I failed to make it work. Now I realize that I had installed a version other than the Hotspot Java which is recommended by Quarkus.

---

<div class="post-metadata">

**Author:** ![ohm](https://forum.devtalk.com/user_avatar/forum.devtalk.com/ohm/32/559_2.png) [@ohm](https://forum.devtalk.com/u/ohm)\
**Post date:** [3 March 2021 20:40 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/10 "2021-03-03T20:40:13Z")

</div>

I’ve previously used `jenv` for handling multiple versions of Java (for use with JRuby), but if you’re already using `asdf` I think you should just continue with that and not introduce yet another new tools.

---

<div class="post-metadata">

**Author:** ![finner](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/f/a4c791/32.png) [@finner](https://forum.devtalk.com/u/finner)\
**Post date:** [4 March 2021 08:51 UTC](https://forum.devtalk.com/t/how-to-install-multiple-java-versions/7486/11 "2021-03-04T08:51:21Z")

</div>

yes I would agree with @ohm - mixing tools will get very confusing. I’ve never heard of `jenv` either. 😃
