A few lines of cmd commands to easily package java files into jar files

1. Create a .java file in any directory

2. Use the cmd command in the current directory: javac filename to compile

If an error is reported, use this command javac -encoding UTF-8 filename

3. The .class file has been successfully generated at this time

4. You can manually add the MANIFEST.MF file

Manifest-Version: 1.0
Main-Class: fileName

5. Directly use jar cvfm Robotsdaka.jar MANIFEST.MF *.class in one step to solve the main list error problem

Scheduled task execution:

You can use the task scheduler that comes with Windows to achieve this requirement. Specific steps are as follows:

  1. Create a new task schedule, which can be found in Control Panel -> Administrative Tools -> Task Scheduler.
  2. Create a new task in the task scheduler, set the trigger to 8:00, 12:00 and 19:00 every working day, and set the action to run the bat file to execute the jar file.
  3. Save and enable the task.

Guess you like

Origin blog.csdn.net/weixin_42450130/article/details/133754003