Brief discussion on the main method in Java execution of jar package
Package jar files through OneJar or Maven, use the command:
java -jar ****.jar
The specified main method is always run after execution. If there are multiple main methods in the jar, how to run the specified main method?
Try it with the following command:
java -classpath ****.jar ****.****.className [args]
"****.****" means "package name";
"className" means "class name";
"[args]" means the passed parameter;
Run the main method specified in MANIFEST.MF directly:
java -jar mplus-service-jar-with-dependencies.jar
Run the specified main method:
java -cp mplus-service-jar-with-dependencies.jar com.smbea.dubbo.bin.Console start
The above article briefly talks about the main method in Java execution of the jar package is all the content I share with you. I hope it can give you a reference and I hope you can support Wulin.com more.