Use the. bat file or cmd to run the. jar file as follows:
1. Run the jar file in the. bat file
Java-jar +jar file path to a text file, and then modify the suffix name to Xxx.bat and then double-click to open the following example:
Java-jar D:\test\me_active.jar
2. Run directly in the CMD window
In the cmd inside direct run Java-jar D:\test\me_active.jar This sentence on the line
Note: The JDK installation is correct and the jar file can be executed.
3. You can specify initialization parameters for the main method execution, such as your executable file as follows:
Import Java.awt.Frame;
public class Testframe {
public static void Main (String args[]) {
String s = args[0];
Frame f = new frame (s);
F.setsize (200,100);
F.setvisible (TRUE);
}
}
The file after the export is Test.jar you can write this when you run:
Java-jar D:\test.jar 123 456
Then the results after the run are:
To export a method that performs a. jar file:
Select an item, right-click the export, select Java-> to run the jar file, select the Java file that the main method runs, select the exported file location and file name, and then click Finish to generate the executable. jar file, and then you can run it where you need it.