Skip to content

Launcher fails to find main method when it is parameterless #47311

@wilkinsona

Description

@wilkinsona

The launcher already supports Java 25's package-private main methods (it uses getDeclaredMethod, and has always done so) but it fails to find a parameterless main method. The failure looks similar to the following:

Exception in thread "main" java.lang.NoSuchMethodException: com.example.demo.DemoApplication.main([Ljava.lang.String;)
	at java.base/java.lang.Class.getDeclaredMethod(Class.java:2422)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:100)
	at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:64)
	at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:40)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions