Skip to content

Set java.home and added some comments #1199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app/src/processing/app/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ static public void init() {
"An unknown error occurred while trying to load\n" +
"platform-specific code for your machine.", e);
}

// Fix the issue where `java.home` points to the JRE instead of the JDK. processing/processing4#1163
System.setProperty("java.home", getJavaHome().getAbsolutePath());
}


Expand Down Expand Up @@ -389,6 +392,7 @@ static public File getContentFile(String name) {
}

static public File getJavaHome() {
// Get the build in JDK location from the Jetpack Compose resources
var resourcesDir = System.getProperty("compose.application.resources.dir");
if(resourcesDir != null) {
var jdkFolder = new File(resourcesDir,"jdk");
Expand All @@ -397,10 +401,13 @@ static public File getJavaHome() {
}
}

// If the JDK is set in the environment, use that.
var home = System.getProperty("java.home");
if(home != null){
return new File(home);
}

// Otherwise try to use the Ant embedded JDK.
if (Platform.isMacOS()) {
//return "Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java";
File[] plugins = getContentFile("../PlugIns").listFiles((dir, name) -> dir.isDirectory() &&
Expand Down
Loading