1

When I use

/usr/libexec/java_home

I get

/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home

but I want to be getting

/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home

I've changed my .zshrc file a number of times and it seems to always revert to the default of temurin 17.

My application will not run android pointing to temurin 17 and it should be selecting zulu 11 jdk.

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
Before The Empire
  • 463
  • 1
  • 5
  • 15
  • 1
    Do you happen to be using IntelliJ or Android Studio? I believe you can change the JVM to whichever you please for certain projects in Preferences. – Rhett Harrison Jul 06 '22 at 13:57
  • 1
    A good tool to easily switch between java versions on the fly is [sdkman](https://sdkman.io/) – Aserre Jul 06 '22 at 14:12
  • Did you check [this](https://medium.com/notes-for-geeks/java-home-and-java-home-on-macos-f246cab643bd) page? It shows how to run a Java process with a specific JAVA_HOME setting. – user1934428 Jul 06 '22 at 14:54

1 Answers1

3

One thing you should do after changing .zshrc file is to execute:

source ~/.zshrc in order for the changes in your .zshrc to be activated


But I would suggest when working with multiple java version, to setup alias and be able to easily change versions on-demand.

You can find a guide for this on this Stackoverflow answer: https://stackoverflow.com/a/40754792/2352196

Bojan Trajkovski
  • 1,056
  • 1
  • 15
  • 31