JAR command package and run active

zhaozj2021-02-16  56

Directory C: / src / boom is released on the source file.

1. Write the Manifest.mf file and place it in the C: / src / boom directory.

Manifest-Version: 1.0main-class: boom.framebombomber

2. Write build.bat placed in C: / src

Path =% java_home% / bin;% path% if not exist class mkdir classesjavac -d classes boom / *. javacd classesjar cvfm ../boom.jar ../boom/manifest.mf boom / *. Class

3. Write run.bat placed in C: / SRC

PATH =% java_home% / bin;% Path% java -jar boom.jar

?

Description:

Main-class: boom.framebombomber specifies the class of the main method: boom.framebombomber, Boom is the name of the package.

Javac -d classes boom / *. Java-D class indicates the path placed in compiled class files. BOOM / *. Java refers to the Java file path.

JAR CVFM ../boom.jar ../boom/manifest.mf boom / *. Classc? Create a new archive v? Generate the detailed output to the standard output F? specify the archive file name, namely: boom.jarm? The flag information indicating the file is: manifest.mf: the Class class file under the C: / SRC / CLASSES / BOOM directory, and the calibration file manifest.mf in the C: / src / boom / directory. And stored in a C: / src directory, the file name is boom.jar

Java -jar boom.jar-jar represents executing the JAR package, performs the main method according to the flag file manifest.mf.

转载请注明原文地址:https://www.9cbs.com/read-18747.html

New Post(0)