I just happen to get that error, on Manjaro ..after an update of the S.O., so the error is the /usr/bin/java now points to the default java installed on the update.

So i just removed all Java versions installed on the updates cause I need only to use the sdkman.

Copysdk home java 8.0.232.hs-adpt

With this i can see where are the candidates on my case:

Copy/home/xxxx/.sdkman/candidates/java/8.0.232.hs-adpt

So after removed all java: i run java -version i found there is no java anymore.

So i force update sdkman

Copysdk selfupdate force

Then after install

Copysource "$HOME/.sdkman/bin/sdkman-init.sh"

And to be sure i ran :

Copyls -al /usr/bin/java

lrwxrwxrwx 1 root root 37 may 16 2020 /usr/bin/java -> /usr/lib/jvm/default-runtime/bin/java

and now it points to where sdkman supposed to:

And thats it now i can change versions again with sdkman.

Copysdk use java 11.0.5.hs-adpt
Answer from cabaji99 on Stack Overflow
🌐
SDKMAN!
sdkman.io › usage
Usage | SDKMAN! the Software Development Kit Manager
Install the latest stable version of your SDK of choice (say, Java JDK) by running the following command: ... In progress... ######################################################################## 100.0% ... Done installing! Now you will be prompted if you want this version to be set as default.
Discussions

How do you change java version using SDKMAN without needing to close Intellij IDEA first? - Stack Overflow
Since P2 uses Java 8, I will open a terminal and use sdkman to change my pc to use Java 8. However, when I attempt this, I get 2 error messages: Copyuser1@ bin $ sdk default java 8.322.06.2-amzn rm: cannot remove '/c/Users/user1/.sdkman/candidates/java/current/lib/jrt-fs.jar': Device or resource ... More on stackoverflow.com
🌐 stackoverflow.com
How do I change default version of java from my terminal?
Please ensure that: Your code is properly formatted as code block - see the sidebar (About on mobile) for instructions You include any and all error messages in full You ask clear questions You demonstrate effort in solving your question/problem - plain posting your assignments is forbidden (and such posts will be removed) as is asking for or giving solutions. Trying to solve problems on your own is a very important skill. Also, see Learn to help yourself in the sidebar If any of the above points is not met, your post can and will be removed without further warning. Code is to be formatted as code block (old reddit: empty line before the code, each code line indented by 4 spaces, new reddit: https://i.imgur.com/EJ7tqek.png ) or linked via an external code hoster, like pastebin.com, github gist, github, bitbucket, gitlab, etc. Please, do not use triple backticks (```) as they will only render properly on new reddit, not on old reddit. Code blocks look like this: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello World!"); } } You do not need to repost unless your post has been removed by a moderator. Just use the edit function of reddit to make sure your post complies with the above. If your post has remained in violation of these rules for a prolonged period of time (at least an hour), a moderator may remove it at their discretion. In this case, they will comment with an explanation on why it has been removed, and you will be required to resubmit the entire post following the proper procedures. To potential helpers Please, do not help if any of the above points are not met, rather report the post. We are trying to improve the quality of posts here. In helping people who can't be bothered to comply with the above points, you are doing the community a disservice. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/javahelp
11
2
December 22, 2023
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
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
🌐
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 ...
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.

🌐
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 - And you can use this Java version, using same switch sdk default command. For example on my case : ... And if you check using sdk list java, it would have >>> mark on it. ... Now, you might be wondering again.
🌐
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 - This is already useful, because we simply go to our project directory, invoke the env command and the Java version is set to the version we expect for our poject. In the next example we start with Java 15 as default version, next we run the env command in the directory with the .sdkmanrc file:
🌐
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 ...
Find elsewhere
🌐
Reddit
reddit.com › r/javahelp › how do i change default version of java from my terminal?
r/javahelp on Reddit: How do I change default version of java from my terminal?
December 22, 2023 -

Currently, when I input "java -version", I get an output of "20.0.1". When I input "/usr/libexec/java_home -V", It says I have 20.0.1, 17.0.9, and 11.0.9.
When I input "export JAVA_HOME=$(/usr/libexec/java_home -v 17.0.9);" to change the version and run "java -version" again, It shows as 17.0.9.
The problem is when I close my terminal and check my java version, it returns back to version 20. How do I permanently change my default java version. Thanks.

🌐
Azul
azul.com › home › blog › easily manage different java versions on your machine with sdkman!
Easily Manage Different Java Versions on Your Machine with SDKMan!
August 30, 2023 - SDKMan!stands for Software Development Kit Manager, a shell script that allows you to manage parallel versions of multiple Software Development Kits for JVM-based languages like Java, Groovy, and Kotlin. With a simple command, you can switch between different versions, set a default version, ...
🌐
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 - Do you want java 11.0.19-amzn to be set as default? (Y/n): Y ... Once you have installed multiple versions of Java using SDKMAN, you can easily switch between them using the below command.🥳 ... Replace this with the version of Java you want to use with the identifier.
🌐
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!
🌐
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 - sdk default java IDENTIFIER Replace IDENTIFIER with the Java version identifier, as seen in the sdk list java command output. For example, to make AdoptOpenJDK version 11.0.8.hs the default system Java version, use: sdk default java 11.0.8.hs-adpt ...
🌐
My Developer Planet
mydeveloperplanet.com › 2022 › 04 › 05 › how-to-manage-your-jdks-with-sdkman
How to Manage Your JDKs With SDKMAN – My Developer Planet
April 5, 2022 - From SDKMAN, choose the AdoptOpenJDK JDK which is now provided by Adoptium and is called Eclipse Temurin. Install the latest JDK 17 LTS version. $ sdk install java 17.0.2-tem Downloading: java 17.0.2-tem In progress... ... Repackaging Java 17.0.2-tem... Done repackaging... Installing: java 17.0.2-tem Done installing! Setting java 17.0.2-tem as default. Verify again what the default Java version is. It has changed to the one you just installed.
🌐
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 - Once SDKMAN is installed and initialized, you can begin managing Java versions. To see the available Java versions you can install, execute: ... => 11.0.11-open | 11.0.11+9 | OpenJDK 11 LTS 8.0.292-open | 8.0.292+10 | OpenJDK 8 LTS 17.0.0-open | 17.0.0+35 | OpenJDK 17 LTS … · To install a specific version of Java, use the following command, replacing {version} with your desired version: ... This will only change the version for the current terminal session.
🌐
OpenRewrite
docs.openrewrite.org › recipe catalog › java › modernize › update sdkman java version
Update SDKMan Java version | OpenRewrite Docs
Given a major release (e.g., 17), the recipe will update the current distribution to the current default SDKMAN version of the specified major release. The distribution option can be used to specify a specific JVM distribution. Note that these must correspond to valid SDKMAN distributions. GitHub: UpdateSdkMan.java, Issue Tracker, Maven Central
Published   1 month ago
🌐
Nidhalnaffati
nidhalnaffati.dev › blog › how-to-update-to-java21
How to Update to Java 21 Using SDKMAN
March 15, 2026 - Replace "21-oracle" with the exact ... a newer version available or if you want another Java vendor. SDKMAN will download and install Java 21 for you. This process may take a few minutes depending on your internet connection and system performance.
🌐
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.