你们需要一个Java Development Kit(JDK)。 这包括一名 Java汇编员(通常称为javac
)和一名jar档案管理员。
假设你在名录上有java文档src
(根据其组合结构)
javac -d classdir -sourcepath src src/*.java src/*/*.java src/*/*/*.java ...
to compile all files. (Adjust the number of * to the number of directory levels. If you only have some folders with source files in them, you can also list them individually. If some classes depend on others, you can ommit the others, the compiler will find and compile them automatically.)
If the program needs external libraries, provide these with a -classpath
argument.
现在,我们都在名录上汇编了各种课程:statdir
。 查阅你原来的杰尔档案:那里的任何非阶级档案也应抄送给您的班子(其前身的相对目录)。 其中最显著的内容是META-INF/MANIFEST.MF
。
然后,我们从这些档案中产生新的jar。 The jar
tool is included in the JDK.
jar cfm mypackage.jar classdir/META-INF/MANIFEST.MF -C classdir .
(You can also simply use a zip program of your confidence and rename the resulting zip file to .jar. If your files have non-ASCII names, make sure to set the filename encoding to UTF-8.)