How does the JavaLauncher App choose a Java version, and how can I change the version it chooses?

If I have multiple versions of Java installed on my Mac, the Java Launcher (/System/Library/CoreServices/JavaLauncher) picks a version to run. It seems to use a version that matches the java_home (/usr/libexec/java_home) default, but there doesn't seem to be a way to change that value.


How does the JavaLauncher choose a java executable? Is there a way to tell it to use a different one?


While I'm using macOS Ventura, this is very likely to be an issue that impacts previous versions.

MacBook Pro (2017 – 2020)

Posted on Sep 22, 2023 1:07 PM

Reply

Similar questions

3 replies

Sep 22, 2023 4:21 PM in response to jazulian

It’s not configurable, as far as I know.

The java_home utility returns a list of installed Java versions based on a criteria set by the app calling java_home. If it doesn’t set a criteria, java_home returns all installed versions.

https://www.manpagez.com/man/1/java_home/


It’s possible you could set the JAVA_HOME environment variable and the app would respect that instead of the results of java_home.

Sep 25, 2023 9:25 AM in response to Barney-15E

"what JavaLauncher" tells me it's from the JavaApplicationSupport project.


Java Developers can be working with multiple JDKs, with one or more for R&D, one or more for Maintainance tasks, and one for everyday use. It would be useful to be able to configure which one of several installed JDKs is used as the default by Finder, the Dock, and Spotlight.


Is there a launchctl command users could use?


If not, how can I open a change request with the JavaApplicationSupport project?

Sep 25, 2023 12:26 PM in response to jazulian

I don’t have any idea on any of those things. I do understand that Apple has abandoned support of Java except the most basic of things. I would think it would be up to Oracle to write that kind of a GUI.

Just alias the individual java commands from each Java home bin and use those to open the specific versions.

As I understand the current state of Java, the JRE should be bundled within the macOS app. You should not expect the user to install Java.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How does the JavaLauncher App choose a Java version, and how can I change the version it chooses?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.