【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

时间:2022-02-09 09:39:58

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

导出jar包

1. File -> Project Structure -> Artifacts

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

2. 点击 “+” 号 -> Add -> 选择第一个jar

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

3. 修改Name XXX(最后产生XXX.jar), Output directory保持默认即可;点击 “+” 号 -> Module Output

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

4. Create Manifest -> 选择工程对应的src文件夹

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

5. Main Class,确定主类(要制作jar包的那个类)

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

6. Build -> Build Artifacts -> Action选择Build(图片没有体现出来)

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包

7. 在对应的输出文件夹里找到打包好的jar包

【图解】在IntelliJ IDEA中导出jar包,制作自己的jar包


引用jar包 (比较简单,不再图解)

1. File -> Project Settings -> Modules

2. Dependencies -> 点击 “+” 号 -> JARs or directories

3. 找到刚才打包好的jar包 -> OK -> Apply -> OK