Skip to content

Commit

Permalink
GH-448 use system property to get main class
Browse files Browse the repository at this point in the history
(cherry picked from commit 975222c)
  • Loading branch information
thurka committed Oct 3, 2022
1 parent 6a1983c commit 86a2661
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class GraalVMApplicationTypeFactory extends MainClassApplicationTypeFacto
private static final String LLVM_MAIN_CLASS = "com.oracle.truffle.llvm.launcher.LLVMLauncher"; // NOI18N
private static final String GRAAL_SYSPROP_ID = "graalvm.home"; // NOI18N
private static final String GRAAL_SYSPROP1_ID = "org.graalvm.home"; // NOI18N
private static final String LAUNCHER_SYSPROP_ID = "org.graalvm.launcher.class"; // NOI18N
private static final String JVM_ARG_GRAAL_ID = "-D"+GRAAL_SYSPROP_ID+"="; // NOI18N
private static final String JVM_ARG_GRAAL1_ID = "-Dgraal.CompilerConfiguration="; // NOI18N
private static final String ARG_GRAAL_ID = "--"; // NOI18N
Expand Down Expand Up @@ -114,6 +115,13 @@ private String getLangID(Jvm jvm) {
String args = jvm.getMainArgs();
String mainClass = jvm.getMainClass();

if ((mainClass == null || mainClass.isEmpty()) && jvm.isGetSystemPropertiesSupported()) {
Properties sysProp = jvm.getSystemProperties();

if (sysProp != null) {
mainClass = sysProp.getProperty(LAUNCHER_SYSPROP_ID);
}
}
if (LEGACY_MAIN_CLASS.equals(mainClass)) {
if (args != null) {
String[] argArr = args.split(" +");
Expand Down

0 comments on commit 86a2661

Please sign in to comment.