Skip to content

Commit 2b48ae3

Browse files
committed
fixup JVM option for MDSplus models creation
1 parent 6581d6b commit 2b48ae3

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎imas/backends/imas_core/mdsplus_model.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import time
1313
import uuid
1414
from pathlib import Path
15-
from subprocess import CalledProcessError, check_output
15+
from subprocess import STDOUT, CalledProcessError, check_output
1616
from zlib import crc32
1717
from packaging.version import Version
1818

@@ -324,13 +324,19 @@ def create_mdsplus_model(cache_dir_path: Path) -> None:
324324
"Could not determine CompileTree class in jTraverser.jar."
325325
)
326326
compiletree = compiletree_class.rpartition(".class")[0].replace("/", ".")
327+
# only add option to suppress warning if the JVM supports it
328+
native_access = ["--enable-native-access=ALL-UNNAMED"]
329+
try:
330+
check_output(["java", *native_access, "-version"], stderr=STDOUT)
331+
except CalledProcessError:
332+
native_access = []
327333
check_output(
328334
[
329335
"java",
330336
"-Xms1g", # what do these do?
331337
"-Xmx8g", # what do these do?
332338
"-XX:+UseG1GC", # what do these do?
333-
"--enable-native-access=ALL-UNNAMED", # Java-25
339+
*native_access,
334340
"-cp",
335341
jarfile,
336342
compiletree,

0 commit comments

Comments
 (0)