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
分享到:
相关推荐
"eapp-personal-quick-start-master.zip" 是一个压缩包,其中包含了用于快速启动这个过程的工程模板。让我们深入探讨一下这个项目的结构和相关知识点。 首先,"eapp-personal-quick-start-master"很可能是一个Git...
one-jar-boot-0.95.jar
2. **apollo-all-in-one.jar** 这是 Apollo 的一体式启动包,包含了 Apollo 服务端的所有组件,包括 AdminServer(配置中心服务器)、MetaServer(元数据服务器)和 ConfigServer(配置服务服务器)。这个 JAR 文件...
webscarab-one-20110329-1330(最新版) webscarab-one-20110329-1330.jar 1、安装JDK 2、鼠标双击webscarab-one-20110329-1330.jar即可
"restclient-ui-3.2.2-jar-with-dependencies" 是这个工具的一个特定版本,该版本包含了所有必要的依赖项,使得用户可以直接运行而无需额外安装其他库。这个版本号表明它是RESTClient的3.2.2迭代,且“jar-with-...
one-jar-boot是底层的JarClassLoader和其他One-JAR引导机制,其中包含One-JAR引导类的源代码()。 那么这个仓库是做什么用的呢? 不幸的是,某些库(例如“适用于Java的AWS开发工具包”)存在问题。 当由one-jar ...
启动时,可以通过运行`java -jar apollo-all-in-one.jar`来启动配置中心。 2. `README.md`:这是一个Markdown格式的文件,通常包含项目的基本介绍、安装指南、使用方法等信息。在Apollo的快速启动包中,它会指导...
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 apollo-all-in-one.jar`,可以启动一个包含所有功能的Apollo实例。 2. **README.md**:这是一个Markdown格式的文件,通常包含了项目的简介、安装步骤、使用方法等详细信息。对于Apollo的快速...
使用方式:java -jar xxx.jar usage: parquet-tools cat [option...] where option is one of: --debug Enable debug output -h,--help Show this help string -j,--json Show records in JSON format. --no-...
1. **apollo-all-in-one.jar**:这是Apollo的全量打包文件,包含了服务端(ConfigService、AdminService)和客户端(ApolloConfigSDK)的所有依赖,用于快速启动和测试Apollo。通过运行这个jar文件,你可以快速搭建...
down2mobile.net_ksoap2-android-assembly-2.4-jar-with-dependencies.jar 用于方方便调用web service
jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2.jar下载jstl-1.2...
1. `apollo-all-in-one.jar`:这是Apollo的核心组件,集成了配置中心的所有功能,包括AdminServer(管理后台)、ConfigService(配置服务)和MetaServer(元数据服务)。将这个JAR文件部署在服务器上,即可启动...
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 和源码。
2. **apollo-all-in-one.jar**: 这是一个包含所有依赖的jar包,通常用于快速启动Apollo服务,方便开发者在本地进行快速测试或调试。只需运行该jar,就可以启动服务端和管理界面。 3. **README.md**: 这个文件...
Java-WebSocket jar包,封装WebSocket实现。
资源共享,20200316,直接使用命令启动:jdk路径 -Xmx300M -Dmax.size=20MB -jar start-site-exec.jar > log.out &
官方版本,亲测可用