Skip to content

Commit 86a2661

Browse files
committed
GH-448 use system property to get main class
(cherry picked from commit 975222c)
1 parent 6a1983c commit 86a2661

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

visualvm/graalvm/src/org/graalvm/visualvm/graalvm/application/type/GraalVMApplicationTypeFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class GraalVMApplicationTypeFactory extends MainClassApplicationTypeFacto
4949
private static final String LLVM_MAIN_CLASS = "com.oracle.truffle.llvm.launcher.LLVMLauncher"; // NOI18N
5050
private static final String GRAAL_SYSPROP_ID = "graalvm.home"; // NOI18N
5151
private static final String GRAAL_SYSPROP1_ID = "org.graalvm.home"; // NOI18N
52+
private static final String LAUNCHER_SYSPROP_ID = "org.graalvm.launcher.class"; // NOI18N
5253
private static final String JVM_ARG_GRAAL_ID = "-D"+GRAAL_SYSPROP_ID+"="; // NOI18N
5354
private static final String JVM_ARG_GRAAL1_ID = "-Dgraal.CompilerConfiguration="; // NOI18N
5455
private static final String ARG_GRAAL_ID = "--"; // NOI18N
@@ -114,6 +115,13 @@ private String getLangID(Jvm jvm) {
114115
String args = jvm.getMainArgs();
115116
String mainClass = jvm.getMainClass();
116117

118+
if ((mainClass == null || mainClass.isEmpty()) && jvm.isGetSystemPropertiesSupported()) {
119+
Properties sysProp = jvm.getSystemProperties();
120+
121+
if (sysProp != null) {
122+
mainClass = sysProp.getProperty(LAUNCHER_SYSPROP_ID);
123+
}
124+
}
117125
if (LEGACY_MAIN_CLASS.equals(mainClass)) {
118126
if (args != null) {
119127
String[] argArr = args.split(" +");

0 commit comments

Comments
 (0)