java is packaged as jar and executes the main methods specified in the jar package

  • 2020-06-15 09:02:45
  • OfStack

java packaged as jar


jar -cvf [jar The name of the package ] [ Files that need to be packaged ]

Execute the main method in the jar package


java -jar ****.jar

If there are multiple main methods in jar, how do you run the specified main method?

Try this with the following command:


java -classpath ****.jar ****.****.className [args]
 " ****.**** "Means" package name "; 
 " className "Means" class name "; 
 " [args] "Represents the passed parameter; 

Run the main method specified in ES20en.MF directly:


java -jar mplus-service-jar-with-dependencies.jar

Run the specified main method (MANIFEST.MF not specified) :


java -cp mplus-service-jar-with-dependencies.jar com.smbea.dubbo.bin.Console start

conclusion


Related articles: