[Eclipse] 怎样把第三方包jar打包到可运行jar包

it2022-05-05  134

1. 在项目下创建一个lib文件夹

2. 把第三方包放到lib下

3.选中项目名,右键选properties->Java Build Path->Libraries->Add JARS,选中lib下面的jar包ok

4. 在项目下创建MANIFEST.MF文件

Manifest-Version: 1.0 Class-Path: lib/org.xbill.dns_2.1.1.jar Main-Class: test.GetIPsByFQDN

 note: 冒号后有空格, 最后一行要换行

Class-Path: 就是第三方jar包路径

Main-Class: test包名,GetIPSByFQDN是main class

项目结构:

5.选中项目,右键Export->Runnable JAR file->next->Launch configuration:选中main class->finish.

 

转载于:https://www.cnblogs.com/sweetyzj/p/7833597.html

相关资源:Eclipse 打可执行JAR包

最新回复(0)