Not set Java version for specific folder and all subfolders
Asked Answered
S

2

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

Subprincipal answered 18/10, 2021 at 9:24 Comment(0)
P
3

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

Piece answered 8/3, 2023 at 6:38 Comment(0)
D
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)?

Dap answered 3/8, 2022 at 16:52 Comment(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.Piece

© 2022 - 2024 — McMap. All rights reserved.