Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public boolean consume(ArgumentQueue args) {
nativeImage.addPlainImageBuilderArg(nativeImage.oHClass + mainClassModuleArgParts[1]);
}
nativeImage.addPlainImageBuilderArg(nativeImage.oHModule + mainClassModuleArgParts[0]);
nativeImage.setModuleOptionMode(true);
return true;
case "--configurations-path":
args.poll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ private static <T> String oR(OptionKey<T> option) {
private boolean diagnostics = false;
String diagnosticsDir;
private boolean jarOptionMode = false;
private boolean moduleOptionMode = false;
private boolean dryRun = false;
private String printFlagsOptionQuery = null;
private String printFlagsWithExtraHelpOptionQuery = null;
Expand Down Expand Up @@ -1177,7 +1178,7 @@ private int completeImageBuild() {
String moduleMsg = USE_NI_JPMS ? " (or <module>/<mainclass>)" : "";
showError("Please specify class" + moduleMsg + " containing the main entry point method. (see --help)");
}
} else {
} else if (!moduleOptionMode) {
/* extraImageArgs main-class overrules previous main-class specification */
explicitMainClass = true;
mainClass = extraImageArgs.remove(0);
Expand Down Expand Up @@ -1783,6 +1784,10 @@ void setJarOptionMode(boolean val) {
jarOptionMode = val;
}

void setModuleOptionMode(boolean val) {
moduleOptionMode = val;
}

boolean isVerbose() {
return verbose;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,9 @@ private int buildImage(String[] arguments, ImageClassLoader classLoader) {
.orElseThrow(() -> UserError.abort("module %s does not have a ModuleMainClass attribute, use -m <module>/<main-class>", moduleName));
}
mainClass = classLoader.forName(className, mainModule);
if (mainClass == null) {
throw UserError.abort("Main entry point class '%s' not found.", className);
}
} catch (ClassNotFoundException ex) {
throw UserError.abort("Main entry point class '%s' not found.", className);
}
Expand Down