After some additional effort to figure this out, it turned out to be an easy fix. SDKman stores the JDKs in this folder:

C:\Users\yourUserName\.sdkman\candidates\java

When you issue the command

sdk default java 8.322.06.2-amzn

it copies the JDK from the java 8 folder

C:\Users\yourUserName\.sdkman\candidates\java\8.322.06.2-amzn

and pastes it into the current folder.

C:\Users\yourUserName\.sdkman\candidates\java\current

The idea is that you point your pc to the "current/" directory so that when you change java version with SDKman, the pc environment variable never needs to be updated.

But for the ide, instead of pointing it to the "current/" directory, you can point it directly to the JDK folder

C:\Users\yourUserName\.sdkman\candidates\java\8.322.06.2-amzn

You can specify the JDK for each project, P1 and P2, separately. So even if you change java version with SDKman, that only effects the "current/" directory, which the ides are no longer pointing at.

Since I did this, I dont have to change java version if I want to switch working on my java 8 project to working on my java 11 project. And that means I dont have to close my java 8 project to open my java 11 project. I can have them both open at the same time, and switch between them easily.

Answer from Steve T on Stack Overflow
🌐
SDKMAN!
sdkman.io › usage
Usage | SDKMAN! the Software Development Kit Manager
The file is pre-populated with the current JDK version in use, but can contain as many key-value pairs of supported SDKs as needed. To switch to the configuration present in your .sdkmanrc file, simply issue the following command: ... Using java version 21.0.4-tem in this shell.
Top answer
1 of 2
6

After some additional effort to figure this out, it turned out to be an easy fix. SDKman stores the JDKs in this folder:

C:\Users\yourUserName\.sdkman\candidates\java

When you issue the command

sdk default java 8.322.06.2-amzn

it copies the JDK from the java 8 folder

C:\Users\yourUserName\.sdkman\candidates\java\8.322.06.2-amzn

and pastes it into the current folder.

C:\Users\yourUserName\.sdkman\candidates\java\current

The idea is that you point your pc to the "current/" directory so that when you change java version with SDKman, the pc environment variable never needs to be updated.

But for the ide, instead of pointing it to the "current/" directory, you can point it directly to the JDK folder

C:\Users\yourUserName\.sdkman\candidates\java\8.322.06.2-amzn

You can specify the JDK for each project, P1 and P2, separately. So even if you change java version with SDKman, that only effects the "current/" directory, which the ides are no longer pointing at.

Since I did this, I dont have to change java version if I want to switch working on my java 8 project to working on my java 11 project. And that means I dont have to close my java 8 project to open my java 11 project. I can have them both open at the same time, and switch between them easily.

2 of 2
0

Inside IntelliJ versus outside IntelliJ

  • For running a project from within IntelliJ, you specify which JDK to use by configuring within IntelliJ.
  • The current default JDK set by SDKMAN! only applies to Java apps being executed on their own, outside IntelliJ.

Unfortunately, configuring which JDK to run your app within IntelliJ is complicated and confusing, requiring you to go spelunking through various buried panels.

These panels include some for the JDK, and some for the language level (which version of Java to target):

  • File | Project Structure | Project Settings | Project | SDK … and Language Level.
  • File | Project Structure | Project Settings | Project | Modules | Language Level.
  • Settings | Build, Execution, Deployment | Compiler | Java Compiler | Per-module bytecode version.

There may be others I don't recall at the moment. Search Stack Overflow to learn more.

If you are building a Web app in IntelliJ Ultimate edition, and running that app from within IntelliJ via an external application server such as Tomcat, Jetty, Glassfish, OpenLiberty, etc., then you need to also specify in another IntelliJ panel which JDK should be used to launch that app server.

If using Maven or Gradle, you need to specify language level there too.

Discussions

Easily switch between java versions with SDKMAN! and 'j'
Gradle and toolchain is my personal best solution. So you don't need to configure your environment on each project if you have to manage different java version. And in addition it works very well together with sdkman. More on reddit.com
🌐 r/java
41
20
December 30, 2022
Why won't sdkman change my default java version? - Stack Overflow
This problem persisted after updating and upgrading sdkman, deleting .sdkman and reinstalling it, and uninstalling java packages and reinstalling them. me@myMachine myProject $ sdk default java 8.0... More on stackoverflow.com
🌐 stackoverflow.com
sdk - Java Version Switch - Stack Overflow
Can I have ALL the Java versions, from 1 to 21, installed in my computer and simply SWITCH between versions whenever I need to work with a specific version?! If YES, how can I do it?! If NO, Thank you! Haven't tried yet because I don't know how to do it. ... Yes you can. You should use the SDK Man software. ```curl -s "get.sdkman... More on stackoverflow.com
🌐 stackoverflow.com
Switching versions of Java on Mac OSX
Not standard, but easier, try using sdkman. More on reddit.com
🌐 r/javahelp
10
1
January 7, 2023
🌐
Wimdeblauwe
wimdeblauwe.com › blog › 2018 › 2018-09-26-switching-between-jdk-8-and-11-using-sdkman-
Switching between JDK 8 and 11 using SDKMAN - Wim Deblauwe
September 26, 2018 - To temporarily switch to another version, use the sdk use command. For instance, if you made JDK 8 the default, then switch to JDK 11 in the current session by typing: ... 21:08 $ java -version openjdk version "11" 2018-09-25 OpenJDK Runtime ...
🌐
Opensource.com
opensource.com › article › 22 › 3 › manage-java-versions-sdkman
Manage Java versions with SDKMan | Opensource.com
March 15, 2022 - Instead you can type sdk install java 11 and then press Tab a few times to get the options. Alternately, you can just install the default latest version: ... You can do more customization with SDKMan, including updating and upgrading Java versions ...
🌐
Medium
medium.com › @zorozeri › manage-java-version-using-sdkman-including-maven-gradle-scala-kotlin-and-many-more-82532be9437e
Manage Java Version using SDKMAN! (including Maven, Gradle, Scala, Kotlin… and many more!) | by Ahmad Azeri Chandra Bhuana | Medium
January 16, 2025 - If this is the first time Java is installed using SDKMAN! it will be used as the default Java. You can check it by run usual java -version command : ... Now, let’s install the second Java version.
🌐
DEV Community
dev.to › teaganga › how-to-install-java-on-linux-and-use-sdkman-to-switch-between-versions-249l
How to install Java on Linux and use SdkMan to switch between versions - DEV Community
June 13, 2025 - openjdk version "17.0.x" 202x-xx-xx OpenJDK Runtime Environment (build 17.0.x+xx-Ubuntu-...) OpenJDK 64-Bit Server VM (build 17.0.x+xx-Ubuntu-..., mixed mode) (Optional) Set JAVA_HOME Many tools need the JAVA_HOME environment variable. First find where Java was installed: ... That might return, for example, /usr/lib/jvm/java-17-openjdk-amd64/. To set it system-wide, edit /etc/environment: ... (Alternative) Use SDKMAN!
Find elsewhere
🌐
JDriven
jdriven.com › blog › 2020 › 10 › Automatic-Switching-Of-Java-Versions-With-SDKMAN
Automatic Switching Of Java Versions With SDKMAN! - JDriven Blog
October 16, 2020 - configuration we can even let SDKMAN! run the env command when we change to our project directory in our shell. The default location of the configuration file is $HOME/.sdkman/etc/config and we must add the following line sdkman_auto_env=true. With this option we can simply change to our project ...
🌐
WafaiCloud
wafaicloud.com › home › system administrators › linux › managing java versions with sdkman for linux users
Managing Java Versions with SDKMAN for Linux Users - WafaiCloud Blogs
December 29, 2025 - To maintain the Java version for specific projects, create a .sdkmanrc file in your project directory: ... This command reads the .sdkmanrc file and changes the SDK versions according to your specifications.
🌐
Baeldung
baeldung.com › home › devops › guide to sdkman!
Guide to SDKMAN! | Baeldung
November 13, 2025 - Therefore, we copy its identifier, which is the version from the table, and we add it as an argument in the install command: $ sdk install java 14.0.2-zulu Downloading: java 14.0.2-zulu In progress... ########### 100.0% Repackaging Java 14.0.2-zulu... Done repackaging... Installing: java 14.0.2-zulu Done installing! Setting java 14.0.2-zulu as default. SDKMAN!
🌐
DEV Community
dev.to › davey › managing-jdk-versions-with-sdkman-4dp9
Managing JDK Versions With SDKMAN! - DEV Community
August 9, 2021 - What this means, is that it is a powerful tool that allows you to easily change between different versions of the JDK without having to modify JAVA_HOME or other environment variables. Installation is as simple as running a bash command. For Linux and Mac users, simply execute the following command and follow the on-screen instructions. ... For Windows users, the recommended way of installation is via WSL. This is covered in the installation documentation. After installing SDKMAN!, the next stage is to decide which JDK versions you wish to install.
🌐
Apache Pulsar
pulsar.apache.org › setting up jdks using sdkman
Setting up JDKs using SDKMAN | Apache Pulsar
With auto-switching, when there's a .sdkmanrc file in a directory, SDKMAN will switch to the defined Java version.
🌐
Linux Uprising
linuxuprising.com › 2020 › 07 › how-to-install-switch-between-multiple.html
How To Install / Switch Between Multiple Java Versions Using SDKMAN - Linux Uprising Blog
June 17, 2021 - Run this in the directory for which you want to use a custom Java version: sdk env init A file called .sdkmanrc has now been generated in this directory. Open it and change the value of java= to the Java version identifier you want to use, e.g.
🌐
Payara
blog.payara.fish › home › easily manage different java versions on your machine with sdkman!
Easily Manage Different Java Versions on Your Machine with SDKMan!
August 30, 2023 - SDKMan! has you covered, offering a straightforward way to handle different versions without the hassle of juggling configurations manually. With just a few commands, you can install, switch between, or even uninstall different versions of Java (JDK or JRE, it doesn’t matter!).
🌐
Medium
daveyem.medium.com › custom-jdk-versions-per-project-with-sdkman-958e618ab66
Custom JDK Versions Per Project With SDKMAN! | by David | Medium
July 13, 2021 - Now, whenever you change into a directory containing a .sdkmanrc file in it, the JDK will automatically be changed to your desired version. Fantastic ! % cd project1 Using java version 11.0.2-open in this shell.
🌐
Medium
medium.com › @layani.malsha › use-multiple-java-versions-using-sdkman-ef56d71fc3ce
Use Multiple Java versions using SDKMAN | by Layani Malsha | Medium
May 9, 2023 - SDKMAN downloads and installs the specified version of Java on your system. You can verify that the installation was successful by running the below command. ... You can change the default Java version in your system as well as it can be changed the Java version in runtime(Change the Java version in the current shell session only)😯😯
Top answer
1 of 3
4

Yes you can.

You should use the SDK Man software. curl -s "https://get.sdkman.io" | bash

When doing the sdk list java, you will get a screen like this:

=============================================================================== Available Java Versions for Linux 64bit ================================================================================ Vendor | Use | Version | Dist | Status | Identifier -------------------------------------------------------------------------------- Corretto | | 21.0.2 | amzn | | 21.0.2-amzn
| | 21.0.1 | amzn | | 21.0.1-amzn
| | 17.0.10 | amzn | | 17.0.10-amzn
| | 17.0.9 | amzn | | 17.0.9-amzn
| | 11.0.22 | amzn | | 11.0.22-amzn
| | 11.0.21 | amzn | | 11.0.21-amzn
| | 8.0.402 | amzn | | 8.0.402-amzn
| | 8.0.392 | amzn | | 8.0.392-amzn Dragonwell | | 17.0.9 | albba | | 17.0.9-albba
| | 11.0.21 | albba | | 11.0.21-albba
| | 11.0.20 | albba | | 11.0.20-albba
| | 8.0.402 | albba | | 8.0.402-albba
| | 8.0.392 | albba | | 8.0.392-albba
| | 8.0.382 | albba | | 8.0.382-albba Gluon | | 22.1.0.1.r17 | gln | | 22.1.0.1.r17-gln
| | 22.1.0.1.r11 | gln | | 22.1.0.1.r11-gln GraalVM CE | | 21.0.2 | graalce | | 21.0.2-graalce
| | 21.0.1 | graalce | | 21.0.1-graalce
| | 17.0.9 | graalce | | 17.0.9-graalce GraalVM Oracle| >>> | 21.0.2 | graal | installed | 21.0.2-graal
| | 21.0.1 | graal | | 21.0.1-graal
| | 17.0.10 | graal | | 17.0.10-graal
| | 17.0.9 | graal | | 17.0.9-graal

First of all you should install all the different version by: sdk install java yourVersion like sdk install java 21.0.1-graalce or sdk install java 17.0.9-graalce or sdk install java 23.ea.12-open.

This allows you to go to a directory and do sdk use java 21.0.1-graalce.

This will activate the JDK 21 version of the GraalVM CommunityEdition (CE). You can do this for different version in different directories.

2 of 3
0

For support purposes I have multiple versions of Java installed all the time. Namely, I have:

  • Oracle Java 6
  • Oracle Java 7
  • Oracle Java 8
  • Oracle Java 11
  • OpenJDK 11
  • OpenJDK 17
  • OpenJDK 21

Yes, I have two Java 11 from different sources.

You can download the packages separately and decompress them. This stategy avoids using the installers since they will try to manage the system properties and set/reset their own versions as the "default one". You probably want to manage the default manually, not automatically.

Now, your folder will look like:

Copyjdk1.6.0_34
jdk1.7.0_40
jdk1.8.0_51
openjdk-11+28
java -> jdk-11+28  (this is a symlink)
...

The PATH variable includes the symlink folder only. This way I decide which java version to use by switching the java symlink -- that is pointing in this example to the OpenJDK 11. If I want to use Java 6, I can repoint the symlink by doing:

Copyrm java
ln -s jdk1.6.0_34 java

Easy, isn't it?

Finally, most IDEs can make this change a lot easier, but I wanted to show you the manual way of doing things, so you can understand there's no magic behind it.

🌐
Mac Install Guide
mac.install.guide › java › sdkman
Install SDKMAN for Java on Mac · Mac Install Guide · 2026
Use sdk default to change the Java version for all new terminal sessions: $ sdk default java 25.0.1-tem setting java 25.0.1-tem as the default version for all shells. This updates the current symlink in ~/.sdkman/candidates/java/ and affects ...