The bat batch command runs the main method in the jar package

1. How to use Eclipse to export a runnable jar (the method in the main function depends on a third-party library):
1. Extract the dependent third-party library into the exported jar package
2. Independently export the dependent third-party library, file The folder naming method is: the exported jar name _lib
as shown in the figure:



this method will bring its own manifest file when exporting, here I choose the second export method.



Second, the bat batch command runs the way in the jar package:

1. The jar that needs to be run contains only one main method.
2. The jar to be run contains multiple main methods, and conversion processing is required when bat is executed.

1. The name of the first batch input is as follows:
(1) If the JDK environment variable is configured in the local environment, the batch script directly writes java -jar ****.jar



(2) The jdk is installed in the local environment, but not configured JDK environment variable, the batch script directly writes jdk installation path /bin/java -jar ****.jar


2. The second batch input is named as follows:
(1) If the JDK environment variable is configured in the local environment, batch processing The script directly writes java -cp ****.jar; the full path of the class , the jar semicolon is followed by a space


(2) jdk is installed in the local environment, but the JDK environment variable is not configured, the batch script directly writes the jdk installation path/bin /java -cp ****.jar; the full path of the class , there is a space after the jar semicolon

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326072995&siteId=291194637