Skip to content

Commit

Permalink
Recognize JAVA_OPTS environment variable and pass it to the JVM
Browse files Browse the repository at this point in the history
  • Loading branch information
JaroslavTulach committed Jun 28, 2024
1 parent 8f18b2f commit 54bb7d8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion engine/runner/src/main/java/org/enso/runner/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ private void launch(String[] args) throws IOException, InterruptedException, URI
var jvm = line.getOptionValue(JVM_OPTION);
var current = System.getProperty("java.home");
if (jvm == null) {
jvm = current;
jvm = current;
}
if (current == null || !current.equals(jvm)) {
var loc = Main.class.getProtectionDomain().getCodeSource().getLocation();
Expand All @@ -1338,6 +1338,16 @@ private void launch(String[] args) throws IOException, InterruptedException, URI
} else {
commandAndArgs.add(new File(new File(new File(jvm), "bin"), "java").getAbsolutePath());
}
var jvmOptions = System.getenv("JAVA_OPTS");
if (jvmOptions != null) {
for (var op : jvmOptions.split(" ")) {
if (op.isEmpty()) {
continue;
}
commandAndArgs.add(op);
}
}

commandAndArgs.add("--add-opens=java.base/java.nio=ALL-UNNAMED");
commandAndArgs.add("--module-path");
var component = new File(loc.toURI().resolve("..")).getAbsoluteFile();
Expand Down

0 comments on commit 54bb7d8

Please sign in to comment.