From 78c127ab1d85f72f69e959eda5e039e7547328ca Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Sun, 22 Sep 2013 16:57:14 -0400 Subject: [PATCH] add java executable on OS X, force local when running --- app/src/processing/app/Base.java | 18 +++++ .../processing/mode/java/runner/Runner.java | 9 ++- build/build.xml | 80 ++++--------------- .../com/oracle/appbundler/AppBundlerTask.java | 16 +++- 4 files changed, 53 insertions(+), 70 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 44cb895df..d0c98d4a4 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -2384,6 +2384,24 @@ public class Base { */ return new File(processingRoot, name); } + + + /** Get the path to the embedded Java executable. */ + static public String getJavaPath() { + if (isMacOS()) { + //return "Contents/PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java"; + return getContentFile("../PlugIns/jdk1.7.0_40.jdk/Contents/Home/jre/bin/java").getAbsolutePath(); + + } else if (isLinux()) { + return getContentFile("../java/bin/java").getAbsolutePath(); + + } else if (isWindows()) { + return getContentFile("../java/bin/java.exe").getAbsolutePath(); + } + System.err.println("No appropriate platform found. " + + "Hoping that Java is in the path."); + return Base.isWindows() ? "java.exe" : "java"; + } // /** diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index c7a0599ff..4bc3cb72d 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -142,7 +142,9 @@ public class Runner implements MessageConsumer { String[] commandArgs = null; if (!Base.isMacOS()) { commandArgs = new String[] { - "java", jdwpArg + //"java", + Base.getJavaPath(), + jdwpArg }; } else { // Decided to just set this to 1.6 only, because otherwise it's gonna @@ -160,7 +162,7 @@ public class Runner implements MessageConsumer { // OS X at this point, because we require 10.6.8 and higher. That also // means we don't need to check for any other OS versions, the user is // a douchebag and modifies Info.plist to get around the restriction. - if (true) { + if (false) { if (System.getProperty("os.version").startsWith("10.6")) { commandArgs = new String[] { "/usr/libexec/java_home", @@ -183,7 +185,8 @@ public class Runner implements MessageConsumer { } else { // testing jdk-7u40 commandArgs = new String[] { - "/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/bin/java", + //"/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/bin/java", + Base.getJavaPath(), jdwpArg }; } diff --git a/build/build.xml b/build/build.xml index 2e58cc6cf..40478d795 100755 --- a/build/build.xml +++ b/build/build.xml @@ -473,31 +473,6 @@ - - - - - - - - + + - - - - - -