First, preface
Some parameters of the JAVA JAVAC jar
Second, JAVA files
Third, the specific operation
1.
Compile the Java file, this example path C:\Users\victor.min\Desktop\printFileName\PrintChoseFileName.java
CD C:\Users\victor.min\Desktop\printFileNamejavac *.java
A few more class files will be found under the C:\Users\victor.min\Desktop\printFileName path
2, create the corresponding structure diagram
The package in this article is Org.happymzw.PrintChoseFileName
So create a folder src/org/happymzw/, and then put the compiled printchosefilename.class file into src/org/happymzw/, the final layer structure is src/ org/happymzw/printchosefilename.class
3, write the MANIFEST.MF file of the phase, this is very important, for the executable jar
Main-class:org.happymzw.pringchosefilename in MANIFEST.MF file
Main-class a colon followed by a space, followed by the class to include the package name, or run when the hint is not found, and finally must have a line-break key, that is, the last empty line out
Then CD to C:\USERS\VICTOR.MIN\DESKTOP\PRINTFILENAME\SRC, run the jar CVFM Test.jar manifest.mf./*
Test.jar: Name is the exported jar name, you can take it yourself
MANIFEST.MF: It's just a main-class file.
./*: Refers to all class files in the subfolders of the current folder
CD C:\Users\victor.min\Desktop\printFileName\srcjar CVFM Test.jar manifest.mf./*
4. Execute jar
Run Java-jar Test.jar
Java-jar Test.jar
You can see that the program is started.
Four, PostScript
Use JDK to make potentially running jars