File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,9 @@ static public void init() {
105105 "An unknown error occurred while trying to load\n " +
106106 "platform-specific code for your machine." , e );
107107 }
108+
109+ // Fix the issue where `java.home` points to the JRE instead of the JDK. processing/processing4#1163
110+ System .setProperty ("java.home" , getJavaHome ().getAbsolutePath ());
108111 }
109112
110113
@@ -389,6 +392,7 @@ static public File getContentFile(String name) {
389392 }
390393
391394 static public File getJavaHome () {
395+ // Get the build in JDK location from the Jetpack Compose resources
392396 var resourcesDir = System .getProperty ("compose.application.resources.dir" );
393397 if (resourcesDir != null ) {
394398 var jdkFolder = new File (resourcesDir ,"jdk" );
@@ -397,10 +401,13 @@ static public File getJavaHome() {
397401 }
398402 }
399403
404+ // If the JDK is set in the environment, use that.
400405 var home = System .getProperty ("java.home" );
401406 if (home != null ){
402407 return new File (home );
403408 }
409+
410+ // Otherwise try to use the Ant embedded JDK.
404411 if (Platform .isMacOS ()) {
405412 //return "Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java";
406413 File [] plugins = getContentFile ("../PlugIns" ).listFiles ((dir , name ) -> dir .isDirectory () &&
You can’t perform that action at this time.
0 commit comments