Quick Start
There are various approaches to getting started with One-JAR. Ant users will find the "Application Generator Approach" most useful, Maven users the "Maven Approach", command-line tool users may prefer the "Command Line Approach".
Application Generator Approach
This approach provides you with a complete Eclipse/Ant application directory, which you can use as a starting point for your own One-JAR application. The application generator is driven by a template built into the one-jar-appgen.jar file (see one-jar-appgen)
Download one-jar-appgen-0.97.jar
Generate application, build, and run it.
$ java -jar one-jar-appgen-0.97.jar
Enter project path (project name is last segment): c:/tmp/test-one-jar
Enter java package name: com.example.onejar
$ cd c:/tmp/test-one-jar
$ ant
$ cd build
$ java -jar test-one-jar.jar
test_one_jar main entry point, args=[]
test_one_jar main is running
test_one_jar OK.
Add source code to the src directory, library jars to the lib directory, and rebuild.
Command-Line Approach
The use of Ant is not required: a One-JAR archive is simple to build using just the jar tool using the following steps.
Create a working directory to act as the "root" of the one-jar with main, lib sub-directories.
Copy your main application jar file into root/main and library dependencies into root/lib
Unjar the one-jar-boot-0.97.jar file into the root directory, and delete the "src" tree
Edit the boot-manifest.mf file and add a new line: One-Jar-Main-Class: your-main-class
cd root; jar -cvfm ../one-jar.jar boot-manifest.mf .
You should end up with a One-JAR archive which mirrors the "root" tree:
one-jar.jar
| META-INF/MANIFEST.MF
| .version
| com/simontuffs/onejar
| Boot.class, ...etc.
| doc/one-jar-license.txt
| main/main.jar
| lib/a.jar ...etc.
Thats it: no code to write, just a directory tree, some copy operations, and a file edit. The One-JAR classloader discovers the libraries and main code based on their position in the archive, and ignores any other Jar files should you need to embed archives which should not be on the classpath. Embedding the one-jar-license.txt ensures compliance with the BSD-style license.
Maven Approach
There is a Maven2 plugin for One-JAR. It is easy to use for Maven projects. Please consult the documentation here: http://code.google.com/p/onejar-maven-plugin/
Ant Taskdef Approach
Detailed use of the One-JAR Ant Taskdef is discussed here. Note that the one-jar-appgen approach uses the Ant taskdef.
SDK Approach
Use of the (deprecated) SDK is discussed here
分享到:
相关推荐
one-jar-boot-0.95.jar
阿里钉钉开放平台spring boot 后端java 钉钉小程序 demo 工程项目!
webscarab-one-20110329-1330(最新版) webscarab-one-20110329-1330.jar 1、安装JDK 2、鼠标双击webscarab-one-20110329-1330.jar即可
RESTClient-全能HTTP请求模拟器-HTTP请求测试工具 restclient-ui-3.2.2-jar-with-dependencies
one-jar-boot是底层的JarClassLoader和其他One-JAR引导机制,其中包含One-JAR引导类的源代码()。 那么这个仓库是做什么用的呢? 不幸的是,某些库(例如“适用于Java的AWS开发工具包”)存在问题。 当由one-jar ...
ksoap2-android-assembly-2.6.5-jar-with-dependencies.jar 要是需要最新的,下载地址: http://code.google.com/p/ksoap2-android/
One-JAR(TM) 是 Java 中一个棘手问题的简单解决方案:当应用程序依赖于多个其他 jar 文件时,如何将其作为单个 jar 文件分发。 One-JAR使用自定义的类加载器来发现主jar中的库jar文件。
java -jar baksmali-2.0.3.jar -x android.odex java -jar smali-2.0.3.jar out -o classes.dex /////////// android 合并apk和odex文件 前提:正确安装JDK和配置环境变量 需要这个apk所在的rom里面的一些jar...
ksoap2-android-assembly-3.2.0-jar-with-dependencies wcf所用包
Apollo(阿波罗)是携程框架部门研发的分布式配置... 包括:apollo-quick-start-1.6.1.zip、apollo-portal-1.6.1-github.zip、apollo-configservice-1.6.1-github.zip、apollo-adminservice-1.6.1-github.zip 和源码。
官方版本,亲测可用
官方版本,亲测可用
该资源为mysql-connector-java-8.0.31-jar包,欢迎下载哦!
mybatis-3.4.1-的jar包
maven-one-plugin-1.2.jar
maven-one-plugin-1.1.jar
maven-one-plugin-1.0.jar
javaee.jar,jsf-api.jar,jsf-impl.jar,jstl-1.2.jar
activemq-all-5.2.0-jar包
改包里面包含了最新的axis2-jar包最全,其中增加了axis-schema.jar, mailapi.jar,xmlsec-1.3.0.jar等,希望能帮助到你