diff --git a/.idea/misc.xml b/.idea/misc.xml index f0c744c0c..43b163889 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,7 +1,7 @@ - + \ No newline at end of file diff --git a/app/src/processing/app/Platform.java b/app/src/processing/app/Platform.java index f391ad262..8e4c43e97 100644 --- a/app/src/processing/app/Platform.java +++ b/app/src/processing/app/Platform.java @@ -429,11 +429,17 @@ public class Platform { if(new File(home, "bin/java").exists()){ return new File(home); }else{ - // TODO make platform independent - // Windows: C:\Program Files\Eclipse Adoptium\jdk-17* - // macOS/Linux: /usr/lib/jvm/, /opt/, /Library/Java/JavaVirtualMachines/ - - return new File("/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home"); + String os = System.getProperty("os.name").toLowerCase(); + // Default installation paths for different operating systems + if (os.contains("windows")) { + var programFiles = new File(System.getenv("ProgramFiles")); + return new File(programFiles, "Eclipse Adoptium/jdk-17.0.10+7-hotspot"); + } else if (os.contains("mac")) { + return new File("/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home"); + } else { + // Linux and others + return new File("/usr/lib/jvm/temurin-17-jdk"); + } } } if (Platform.isMacOS()) {