diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 898397b88..59be722ce 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1644,6 +1644,12 @@ public class Base { return PConstants.platformNames[PApplet.platform]; } + + /** + * Return whether sketches will run as 32- or 64-bits. On Linux and Windows, + * this is the bit depth of the machine, while on OS X it's determined by the + * setting from preferences, since both 32- and 64-bit are supported. + */ static public int getNativeBits() { if (Base.isMacOS()) { return Preferences.getInteger("run.options.bits"); diff --git a/app/src/processing/mode/java/runner/Runner.java b/app/src/processing/mode/java/runner/Runner.java index 3453f3cad..219787e21 100644 --- a/app/src/processing/mode/java/runner/Runner.java +++ b/app/src/processing/mode/java/runner/Runner.java @@ -84,7 +84,7 @@ public class Runner implements MessageConsumer { // private String appletClassName; - public Runner(JavaBuild build, RunnerListener listener) { + public Runner(JavaBuild build, RunnerListener listener) throws SketchException { this.listener = listener; // this.sketch = sketch; this.build = build; @@ -94,6 +94,14 @@ public class Runner implements MessageConsumer { // } else { // System.out.println("actually it's a " + listener.getClass().getName()); } + + // Make sure all the imported libraries will actually run with this setup. + int bits = Base.getNativeBits(); + for (Library library : build.getImportedLibraries()) { + if (!library.supportsArch(PApplet.platform, bits)) { + throw new SketchException(library.getName() + " does not run in " + bits + "-bit mode."); + } + } } @@ -281,7 +289,7 @@ public class Runner implements MessageConsumer { "java -Xrunjdwp:transport=dt_shmem,address=" + addr + ",suspend=y "; } else if (Base.isMacOS()) { commandArgs = - "java -d" + Preferences.get("run.options.bits") + + "java -d" + Base.getNativeBits() + //Preferences.get("run.options.bits") + " -Xrunjdwp:transport=dt_socket,address=" + addr + ",suspend=y "; }