add java executable on OS X, force local when running

This commit is contained in:
Ben Fry
2013-09-22 16:57:14 -04:00
parent 9dda73b3f1
commit 78c127ab1d
4 changed files with 53 additions and 70 deletions

View File

@@ -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";
}
// /**

View File

@@ -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
};
}

View File

@@ -473,31 +473,6 @@
<target name="macosx-build" if="macosx" depends="revision-check, macosx-checkos, subprojects-build" description="Build Mac OS X version">
<mkdir dir="macosx/work" />
<!-- assemble the pde -->
<!--
<copy todir="macosx/work">
<fileset dir="macosx/" includes="template.app/**"/>
</copy>
<move file="macosx/work/template.app"
tofile="macosx/work/Processing.app" />
<chmod file="macosx/work/Processing.app/Contents/MacOS/JavaApplicationStub" perm="ugo+x" />
<copy todir="macosx/work/Processing.app/Contents/Java/lib"
flatten="true">
<fileset refid="runtime.jars"/>
</copy>
-->
<!-- workaround for apparent appbundler bug -->
<!--
<copy todir=".">
<fileset dir="macosx/template.app/Contents/Resources/"
includes="*.icns" />
</copy>
-->
<!-- app bundler for OS X and Java 1.7 -->
<taskdef name="bundleapp"
classname="com.oracle.appbundler.AppBundlerTask"
@@ -552,17 +527,22 @@
role="Editor">
</bundledocument>
<!-- Workaround because the icon parameter for bundleapp doesn't work -->
<!--<option value="-Xdock:icon=Contents/Resources/${bundle.icon}" />-->
<!-- Don't think these actually make any difference. -->
<!--
<option value="-Xdock:icon=Contents/Resources/processing.icns" />
<!--<option value="-Xdock:icon=${bundle.icon}" />-->
<!--<option value="-Xdock:icon=processing.icns" />-->
<!-- this one actually works -->
<!--<option value="-Xdock:icon=/Users/fry/coconut/processing/build/macosx/work/Processing.app/Contents/Resources/processing.icns" />-->
<!--<option value="-Xdock:icon=Processing.app/Contents/Resources/processing.icns" />-->
<!-- set the name for what's in the dock -->
<option value="-Xdock:name=Processing" />
-->
<!-- Probably no longer needed? [fry 130917]
<option value="-Xms128M" />
<option value="-Xmx256M" />
-->
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=${bundle.name}"/>
<option value="-Dcom.apple.smallTabs=true"/>
<!--
the old options; most of these are probably no longer useful
@@ -583,25 +563,8 @@
<key>apple.awt.graphics.UseQuartz</key>
<string>true</string>
-->
<option value="-Dapple.laf.useScreenMenuBar=true"/>
<option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
<option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
<option value="-Dcom.apple.mrj.application.apple.menu.about.name=${bundle.name}"/>
<option value="-Dcom.apple.smallTabs=true"/>
<!-- Probably no longer needed? [fry 130917]
<option value="-Xms128M" />
<option value="-Xmx256M" />
-->
</bundleapp>
<!-- workaround for apparent appbundler bug -->
<!--
<delete file="processing.icns" />
<delete file="pde.icns" />
-->
<copy todir="macosx/work/Processing.app/Contents/Java">
<fileset dir=".." includes="core/library/**" />
<fileset dir="shared" includes="launch4j/**" />
@@ -609,21 +572,6 @@
<fileset file="shared/revisions.txt" />
</copy>
<!--
others.. can we set these?
<key>LSMinimumSystemVersion</key>
<string>10.6.8</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>Java</key>
<dict>
<key>SplashFile</key>
<string>$JAVAROOT/lib/about.jpg</string>
-->
<property name="launch4j.dir"
value="macosx/work/Processing.app/Contents/Java/launch4j" />

View File

@@ -203,7 +203,21 @@ public class AppBundlerTask extends Task {
runtime.appendExcludes(new String[] {
"bin/",
"jre/bin/",
// original version, removed entire bin folder
// "jre/bin/",
// remove everything except 'java'
"jre/bin/keytool",
"jre/bin/orbd",
"jre/bin/pack200",
"jre/bin/policytool",
"jre/bin/rmid",
"jre/bin/rmiregistry",
"jre/bin/servertool",
"jre/bin/tnameserv",
"jre/bin/unpack200",
"jre/lib/deploy/",
"jre/lib/deploy.jar",
"jre/lib/javaws.jar",