6

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

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Alexei
  • 14,350
  • 37
  • 121
  • 240

2 Answers2

3

Currently it is not possible. There is a feature request to support this in future. https://github.com/sdkman/sdkman-cli/issues/1102

Matthias Baumgart
  • 905
  • 1
  • 9
  • 22
0

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)?

aednichols
  • 2,292
  • 2
  • 19
  • 28
  • 1
    I have the same issue. SDKMAN 5.17.0 with Java 11 and 17, Mac OS 13. `sdkman_auto_env=true` my default is java 11, for the project I have set java 17. In the subfolders I get java 11 in contrast to the wanted behavior to have the same sdk for all subfolders. – Matthias Baumgart Mar 06 '23 at 16:21