I use maven plugin to set the main class like this :
org.springframework.boot
spring-boot-maven-p
Executing from Windows PowerShell I needed this format (with the quotes):
java -cp .\myjarfile.jar -D"loader.main=com.app.etc.FullyQualifiedMainClass" org.springframework.boot.loader.PropertiesLauncher
To clarify the accepted answer: You can directly modify the loader.main property in the jar's META-INF/MANIFEST.MF file, if you're ok with a more static solution.