Ton*_*yGW 6 java compilation jar
我正在尝试提交我的java作业,并且想要创建一个包含已编译的.class文件以及我原始源代码.java文件的jar文件.我正在使用IntelliJ,但没有找到将.java导出到jar的选项.有没有办法通过命令行来做到这一点?
尝试
jar cf jar-file input-file(s)
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请查看http://docs.oracle.com/javase/tutorial/deployment/jar/build.html
对于 Intellij IDEA 版本 11.0.2
档案 | 项目结构 | Artifacts 然后您应该按 alt+insert 或单击加号图标并创建新的工件选择 --> jar --> From modules with dependencies。
下一步转到构建 | 构建工件 --> 选择您的工件。
请参阅此链接create-jar-with-IntelliJ
- 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45503 次 |
| 最近记录: |