1. Select the java file, right-click and select export---> Select jar file and click next
2. Check export generated class files and resources and export java source files and resoures
Then enter the save path in jar file:
Click next
3.
Click next by default, click next again, click the Browse button behind the main class
Select the main method
finish
4.
Enter cmd to enter the command window
Run the command: java -jar jar path