选择导出成Runnable JAR file:
需要指定一个Launch configuration,以及打包时的库文件处理策略:package required libraries into generated JAR
run configuration指定如下:
arguments标签页留空:
打包好的jar包,解压后发现也包含了使用到的库文件jar:
以及加载jar文件的jarinjarloader:
META-INF文件夹里的MANIFEST.MF内容如下:
Manifest-Version: 1.0 Rsrc-Class-Path: ./ httpclient-4.5.1.jar httpcore-4.4.3.jar json-rpc-1 .0.jar commons-logging-1.2.jar Class-Path: . Rsrc-Main-Class: youdao.YoudaoNoteSingle Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader