Skip to content

Commit 0ef548f

Browse files
committed
work on quoting of java.ext.dirs (processing#4623)
1 parent 51add87 commit 0ef548f

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed

build/windows/config-cmd.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<jre>
3131
<path>java</path>
3232
<!-- Deal with jokers who install JOGL, ANTLR, etc system-wide -->
33-
<opt>-Djava.ext.dirs=%EXEDIR%/java/lib/ext</opt>
33+
<opt>-Djava.ext.dirs="%EXEDIR%/java/lib/ext"</opt>
3434
<!-- Prevent a user-installed JNA from conflicting with our version.
3535
https://github.com/processing/processing/issues/2239 -->
3636
<opt>-Djna.nosys=true</opt>

build/windows/config.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<jre>
2828
<path>java</path>
2929
<!-- Deal with jokers who install JOGL, ANTLR, etc system-wide -->
30-
<opt>-Djava.ext.dirs=%EXEDIR%/java/lib/ext</opt>
30+
<opt>-Djava.ext.dirs="%EXEDIR%/java/lib/ext"</opt>
3131
<!-- https://github.com/processing/processing/issues/2239 -->
3232
<opt>-Djna.nosys=true</opt>
3333
<!-- Because nosys is set to true, the DLL in the current working

java/src/processing/mode/java/JavaBuild.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -956,13 +956,13 @@ protected boolean exportApplication(File destFolder,
956956
if (embedJava) {
957957
// if people don't embed Java, it might be a mess, but what can we do?
958958
if (exportPlatform == PConstants.MACOSX) {
959-
runOptions.append("-Djava.ext.dirs=$APP_ROOT/Contents/PlugIns/jdk" +
959+
runOptions.append("-Djava.ext.dirs=\"$APP_ROOT/Contents/PlugIns/jdk" +
960960
PApplet.javaVersionName +
961-
".jdk/Contents/Home/jre/lib/ext");
961+
".jdk/Contents/Home/jre/lib/ext\"");
962962
} else if (exportPlatform == PConstants.WINDOWS) {
963-
runOptions.append("-Djava.ext.dirs=%EXEDIR%/java/lib/ext");
963+
runOptions.append("-Djava.ext.dirs=\"%EXEDIR%/java/lib/ext\"");
964964
} else if (exportPlatform == PConstants.LINUX) {
965-
runOptions.append("-Djava.ext.dirs=$APPDIR/java/lib/ext");
965+
runOptions.append("-Djava.ext.dirs=\"$APPDIR/java/lib/ext\"");
966966
}
967967
}
968968

java/src/processing/mode/java/runner/Runner.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,25 @@ protected StringList getMachineParams() {
266266
}
267267
}
268268

269-
// params.add("-Djava.ext.dirs=nuffing");
270-
271269
if (Preferences.getBoolean("run.options.memory")) {
272270
params.append("-Xms" + Preferences.get("run.options.memory.initial") + "m");
273271
params.append("-Xmx" + Preferences.get("run.options.memory.maximum") + "m");
274272
}
275273

274+
// Surprised this wasn't here before; added for 3.2.1
275+
params.append("-Djna.nosys=true");
276+
277+
// Added for 3.2.1, was still using the default ext.dirs in the PDE
278+
try {
279+
String extPath =
280+
new File(Platform.getJavaHome(), "lib/ext").getCanonicalPath();
281+
// quoting this on OS X causes it to fail
282+
//params.append("-Djava.ext.dirs=\"" + extPath + "\"");
283+
params.append("-Djava.ext.dirs=" + extPath);
284+
} catch (IOException e) {
285+
e.printStackTrace();
286+
}
287+
276288
if (Platform.isMacOS()) {
277289
params.append("-Xdock:name=" + build.getSketchClassName());
278290
// params.add("-Dcom.apple.mrj.application.apple.menu.about.name=" +

0 commit comments

Comments
 (0)