mirror of
https://github.com/processing/processing4.git
synced 2026-02-16 03:45:40 +01:00
clean up prefs, remove old 32/64-bit stuff from OS X
This commit is contained in:
@@ -63,19 +63,6 @@ public class Runner implements MessageConsumer {
|
||||
// Thread transferring remote output stream to our output stream
|
||||
protected Thread outThread = null;
|
||||
|
||||
// Mode for tracing the Trace program (default= 0 off)
|
||||
// protected int debugTraceMode = 0;
|
||||
|
||||
// Do we want to watch assignments to fields
|
||||
// protected boolean watchFields = false;
|
||||
|
||||
// // Class patterns for which we don't want events
|
||||
// protected String[] excludes = {
|
||||
// "java.*", "javax.*", "sun.*", "com.sun.*",
|
||||
// "apple.*",
|
||||
// "processing.*"
|
||||
// };
|
||||
|
||||
protected SketchException exception;
|
||||
protected Editor editor;
|
||||
protected JavaBuild build;
|
||||
@@ -138,60 +125,6 @@ public class Runner implements MessageConsumer {
|
||||
// Everyone works the same under Java 7 (also on OS X)
|
||||
String[] commandArgs = new String[] { Base.getJavaPath(), jdwpArg };
|
||||
|
||||
/*
|
||||
String[] commandArgs = null;
|
||||
if (!Base.isMacOS()) {
|
||||
commandArgs = new String[] {
|
||||
Base.getJavaPath(),
|
||||
jdwpArg
|
||||
};
|
||||
} else {
|
||||
// Decided to just set this to 1.6 only, because otherwise it's gonna
|
||||
// be a shitshow if folks are getting Apple's 1.6 with 32-bit and
|
||||
// Oracle's 1.7 when run in 64-bit mode. ("Why does my sketch suck in
|
||||
// 64-bit? Why is retina broken?)
|
||||
// The --request flag will prompt to install Apple's 1.6 JVM if none is
|
||||
// available. We're specifying 1.6 so that we can get support for both
|
||||
// 32- and 64-bit, because Oracle won't be releasing Java 1.7 in 32-bit.
|
||||
// Helpfully, the --request flag is not present on Mac OS X 10.6
|
||||
// (luckily it is also not needed, because 1.6 is installed by default)
|
||||
// but it requires an additional workaround to not use that flag,
|
||||
// otherwise will see an error about an unsupported option. The flag is
|
||||
// available with 10.7 and 10.8, the only other supported versions of
|
||||
// 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 (false) {
|
||||
if (System.getProperty("os.version").startsWith("10.6")) {
|
||||
commandArgs = new String[] {
|
||||
"/usr/libexec/java_home",
|
||||
"--version", "1.6",
|
||||
"--exec", "java",
|
||||
"-d" + Base.getNativeBits(),
|
||||
jdwpArg
|
||||
};
|
||||
} else { // for 10.7, 10.8, etc
|
||||
commandArgs = new String[] {
|
||||
"/usr/libexec/java_home",
|
||||
"--request", // install on-demand
|
||||
"--version", "1.6",
|
||||
"--exec", "java",
|
||||
"-d" + Base.getNativeBits(),
|
||||
// debugArg,
|
||||
jdwpArg
|
||||
};
|
||||
}
|
||||
} else {
|
||||
// testing jdk-7u40
|
||||
commandArgs = new String[] {
|
||||
//"/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home/bin/java",
|
||||
Base.getJavaPath(),
|
||||
jdwpArg
|
||||
};
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
commandArgs = PApplet.concat(commandArgs, vmParams);
|
||||
commandArgs = PApplet.concat(commandArgs, sketchParams);
|
||||
// PApplet.println(commandArgs);
|
||||
@@ -482,153 +415,6 @@ public class Runner implements MessageConsumer {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
protected VirtualMachine launchVirtualMachine(String[] vmParams,
|
||||
String[] classParams) {
|
||||
//vm = launchTarget(sb.toString());
|
||||
LaunchingConnector connector = (LaunchingConnector)
|
||||
findConnector("com.sun.jdi.RawCommandLineLaunch");
|
||||
//PApplet.println(connector); // gets the defaults
|
||||
|
||||
//Map arguments = connectorArguments(connector, mainArgs);
|
||||
Map arguments = connector.defaultArguments();
|
||||
|
||||
Connector.Argument commandArg =
|
||||
(Connector.Argument)arguments.get("command");
|
||||
// Using localhost instead of 127.0.0.1 sometimes causes a
|
||||
// "Transport Error 202" error message when trying to run.
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=895
|
||||
// String addr = "127.0.0.1:" + (8000 + (int) (Math.random() * 1000));
|
||||
//String addr = "localhost:" + (8000 + (int) (Math.random() * 1000));
|
||||
// Better yet, host is not needed, so using just the port for the address
|
||||
String addr = "" + (8000 + (int) (Math.random() * 1000));
|
||||
|
||||
String commandArgs =
|
||||
"java -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
|
||||
if (Base.isMacOS()) {
|
||||
// Decided to just set this to 1.6 only, because otherwise it's gonna
|
||||
// be a shitshow if folks are getting Apple's 1.6 with 32-bit and
|
||||
// Oracle's 1.7 when run in 64-bit mode. ("Why does my sketch suck in
|
||||
// 64-bit? Why is retina broken?)
|
||||
// The --request flag will prompt to install Apple's 1.6 JVM if none is
|
||||
// available. We're specifying 1.6 so that we can get support for both
|
||||
// 32- and 64-bit, because Oracle won't be releasing Java 1.7 in 32-bit.
|
||||
// Helpfully, the --request flag is not present on Mac OS X 10.6
|
||||
// (luckily it is also not needed, because 1.6 is installed by default)
|
||||
// but it requires an additional workaround to not use that flag,
|
||||
// otherwise will see an error about an unsupported option. The flag is
|
||||
// available with 10.7 and 10.8, the only other supported versions of
|
||||
// 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, unless
|
||||
// is a douchebag and modifies Info.plist to get around the restriction.
|
||||
addr = "" + (8000 + (int) (Math.random() * 1000));
|
||||
commandArgs =
|
||||
"/usr/libexec/java_home " +
|
||||
(System.getProperty("os.version").startsWith("10.6") ? "" : "--request ") +
|
||||
"--version 1.6 " +
|
||||
"--exec java " +
|
||||
"-d" + Base.getNativeBits() + " " +
|
||||
"-Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y ";
|
||||
}
|
||||
|
||||
for (int i = 0; i < vmParams.length; i++) {
|
||||
commandArgs = addArgument(commandArgs, vmParams[i], ' ');
|
||||
}
|
||||
if (classParams != null) {
|
||||
for (int i = 0; i < classParams.length; i++) {
|
||||
commandArgs = addArgument(commandArgs, classParams[i], ' ');
|
||||
}
|
||||
}
|
||||
System.out.println("commandArgs is " + commandArgs);
|
||||
commandArg.setValue(commandArgs);
|
||||
|
||||
Connector.Argument addressArg =
|
||||
(Connector.Argument)arguments.get("address");
|
||||
addressArg.setValue(addr);
|
||||
|
||||
//PApplet.println(connector); // prints the current
|
||||
//com.sun.tools.jdi.AbstractLauncher al;
|
||||
//com.sun.tools.jdi.RawCommandLineLauncher rcll;
|
||||
|
||||
//System.out.println(PApplet.javaVersion);
|
||||
// http://java.sun.com/j2se/1.5.0/docs/guide/jpda/conninv.html#sunlaunch
|
||||
try {
|
||||
return connector.launch(arguments);
|
||||
} catch (IOException exc) {
|
||||
throw new Error("Unable to launch target VM: " + exc);
|
||||
} catch (IllegalConnectorArgumentsException exc) {
|
||||
throw new Error("Internal error: " + exc);
|
||||
} catch (VMStartException exc) {
|
||||
Process p = exc.process();
|
||||
//System.out.println(p);
|
||||
String[] errorStrings = PApplet.loadStrings(p.getErrorStream());
|
||||
//String[] inputStrings =
|
||||
PApplet.loadStrings(p.getInputStream());
|
||||
|
||||
if (errorStrings != null && errorStrings.length > 1) {
|
||||
if (errorStrings[0].indexOf("Invalid maximum heap size") != -1) {
|
||||
Base.showWarning("Way Too High",
|
||||
"Please lower the value for \u201Cmaximum available memory\u201D in the\n" +
|
||||
"Preferences window. For more information, read Help \u2192 Troubleshooting.",
|
||||
exc);
|
||||
} else {
|
||||
PApplet.println(errorStrings);
|
||||
System.err.println("Using startup command:");
|
||||
PApplet.println(arguments);
|
||||
}
|
||||
} else {
|
||||
exc.printStackTrace();
|
||||
System.err.println("Could not run the sketch (Target VM failed to initialize).");
|
||||
if (Preferences.getBoolean("run.options.memory")) {
|
||||
// Only mention this if they've even altered the memory setup
|
||||
System.err.println("Make sure that you haven't set the maximum available memory too high.");
|
||||
}
|
||||
System.err.println("For more information, read revisions.txt and Help \u2192 Troubleshooting.");
|
||||
}
|
||||
// changing this to separate editor and listener [091124]
|
||||
//if (editor != null) {
|
||||
listener.statusError("Could not run the sketch.");
|
||||
//}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static boolean hasWhitespace(String string) {
|
||||
int length = string.length();
|
||||
for (int i = 0; i < length; i++) {
|
||||
if (Character.isWhitespace(string.charAt(i))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private static String addArgument(String string, String argument, char sep) {
|
||||
if (hasWhitespace(argument) || argument.indexOf(',') != -1) {
|
||||
// Quotes were stripped out for this argument, add 'em back.
|
||||
StringBuffer buffer = new StringBuffer(string);
|
||||
buffer.append('"');
|
||||
for (int i = 0; i < argument.length(); i++) {
|
||||
char c = argument.charAt(i);
|
||||
if (c == '"') {
|
||||
buffer.append('\\');
|
||||
// buffer.append("\\\\");
|
||||
}
|
||||
buffer.append(c);
|
||||
}
|
||||
buffer.append('"');
|
||||
buffer.append(sep);
|
||||
return buffer.toString();
|
||||
|
||||
} else {
|
||||
return string + argument + String.valueOf(sep);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Generate the trace.
|
||||
* Enable events, start thread to display events,
|
||||
|
||||
Reference in New Issue
Block a user