Skip to content

Commit a08ca3b

Browse files
committed
Make sure we only embed java on the current platform **and architecture**.
1 parent 7d86142 commit a08ca3b

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

runtime/src/jycessing/mode/export/Exporter.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ private static void log(final String msg) {
2626
}
2727
}
2828

29+
// Architecture of the currently running Processing JRE.
30+
// Used to determine what platform we can embed java in.
31+
public static final Arch processingArch;
32+
static {
33+
if (Base.getNativeBits() == Arch.X86.bits) {
34+
processingArch = Arch.X86;
35+
} else {
36+
processingArch = Arch.AMD64;
37+
}
38+
}
39+
2940
private Sketch sketch;
3041
private PyEditor editor; // I don't really want to pass this around but there's some functionality
3142
// I need

runtime/src/jycessing/mode/export/LinuxExport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ public LinuxExport(Arch arch, Sketch sketch, PyEditor editor, Set<Library> libra
6262
public void export() throws IOException {
6363
// Work out user preferences and other possibilities we care about
6464
final boolean embedJava =
65-
(id == PApplet.platform) && Preferences.getBoolean("export.application.embed_java");
65+
(id == PApplet.platform) && Preferences.getBoolean("export.application.embed_java")
66+
&& arch == Exporter.processingArch;
6667

6768
// Work out the folders we'll be (maybe) using
6869
final File destFolder = new File(sketch.getFolder(), "application." + name);

runtime/src/jycessing/mode/export/WindowsExport.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ public WindowsExport(Arch arch, Sketch sketch, PyEditor editor, Set<Library> lib
6666
@Override
6767
public void export() throws IOException {
6868
final boolean embedJava =
69-
(id == PApplet.platform) && Preferences.getBoolean("export.application.embed_java");
69+
(id == PApplet.platform) && Preferences.getBoolean("export.application.embed_java")
70+
&& arch == Exporter.processingArch;
7071

7172
final File destFolder = new File(sketch.getFolder(), "application." + name);
7273
final File javaFolder = new File(destFolder, "java");

0 commit comments

Comments
 (0)