使用IntelliJ创建jar文件
对于Intellij IDEA版本11.0.2
档案|项目结构|然后你应该按下alt插入或点击加号图标并创建新的工件选择 – > jar – >来自具有依赖关系的模块.
接下来转到Build |构建工件 – >选择你的神器.
在命令提示符中创建jar文件
- Start Command Prompt.
- Navigate to the folder that holds your class files:
C:\>cd \mywork
- Set path to include JDK’s bin. For example:
C:\mywork> path c:\Program Files\Java\jdk1.7.0_25\bin;%path%
- Compile your class(es):
C:\mywork> javac *.java
- Create a manifest file
manifest.txt with, for example, this content:
Manifest-Version: 1.0
Created-By: 1.8.0_171 (Oracle Corporation) #your jdk version
Main-Class: mainPackage.MainClass
- Create the jar file:
C:\mywork> jar cvfm Craps.jar manifest.txt *.class