Not set Java version for specific folder and all subfolders

Viewed 221

Linux Mint 20
Java 8, 11.
SDKMAN: 5.12.14

Current Java version = 11

I have folder MyProject with 45 subfolders:

MyProject
- mySubfolder1
- mySubfolder2
-...
- mySubfolder45

I want to set specific Java version to 8 to folder MyProject and all its 45 subfolders.

I create file .sdkmanrc in folder MyProject with content:

# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=jdk1.8.0_202

And when I open folder MyProject and use this command:

java -version

I got java = 1.8.

Nice. It works fine.

However, when I open any subfolder, for example mySubfolder2, the Java version is 11.

Is it possible to set Java 8 for folder MyProject and all its subfolders?

I don't want to create file .sdkmanrc in all subfolders

1 Answers

I cannot reproduce this on SDKMAN 5.15.0 with Java 11 & 17, Mac OS 12.5.

Are you sure you set sdkman_auto_env=true in sdk config (which opens the config file in your default editor)?

Related