Skip to main content
13 events
when toggle format what by license comment
Sep 23, 2024 at 11:06 comment added trane77 what do you mean? The last part of the script should set the JAVA_HOME env variable
Sep 18, 2024 at 12:52 comment added Graham Leggett Alas this doesn't cover JAVA_HOME, just the binaries, which isn't enough to make this work.
Aug 18, 2023 at 11:34 comment added trane77 I've just tried sdkman, it works very well and it's easy to install/configure.
S Aug 10, 2023 at 16:23 history suggested Yasien Dwieb CC BY-SA 4.0
removing last xargs dirname was needed for it to work better
Jul 7, 2023 at 14:29 review Suggested edits
S Aug 10, 2023 at 16:23
May 9, 2023 at 1:19 comment added trane77 You should check what the OP suggested, I've read it yesterday in the question...It seems a nice & solution too :-) Cheers
May 8, 2023 at 9:26 comment added Gautam I ended up using part of the solution provided in the previous answer which worked like a charm i.e. export JAVA_HOME=$(dirname $(dirname `readlink -f /etc/alternatives/java`))
May 8, 2023 at 3:33 comment added trane77 I'm not sure @Gautam , unfortunately in this moment I don't have a machine to test. What I can tell you is this: OP asked how to swap SDK version by using update-alternatives. As far as I can remember, that tool let you choose a version, and create a symbolic link afterwards. What I don't remember exactly is the purpose of the script, but as you can see, it reads the sym link, then splits it into parts (xargs dirname) and check if the linked path exists. If that's the case, it assigns that path to JAVA_HOME, which is linked to the sdk root (not bin folder!)
May 6, 2023 at 5:43 comment added Gautam This evaluates the JAVA_HOME to /usr/lib/jvm which is the topmost folder for all jdk installations and not the precise jdk folder. Am I missing something ?
Aug 13, 2020 at 8:40 history edited trane77 CC BY-SA 4.0
Updating the JAVA_HOME variable with a more portable script
Aug 11, 2020 at 11:45 history edited AdminBee CC BY-SA 4.0
Use block code formatting instead of inline code
Aug 11, 2020 at 9:10 review First posts
Aug 11, 2020 at 11:45
Aug 11, 2020 at 9:06 history answered trane77 CC BY-SA 4.0