简体   繁体   中英

Third party lib to create jar files?

I've Goog'd but I can't find any third party library that will let you create a jar file programmatically. I amazed that even Apache commons-io doesn't seem to have such functionality.

I'd rather not implement it myself as the API is rather low level. Are there any 3rd party libraries out there that will do the job?

Edit: I meant programmatically in Java. I don't want to drop out to the shell and I don't want to work with java.io.*.

我不确定“创建一个jar文件”是什么意思,但是ant有一个jar任务 ,它将为您创建一个jar文件

You don't need a third party library. It's all built into Java (the jar command just uses those classes)

http://download.oracle.com/javase/6/docs/api/java/util/jar/package-summary.html

Edit:

It will require you to still work with java.io.* as that is the only way to create files...

I'd suggest you look at JBOSS Arquillian . It provides a fluent interface to create jar, war, ear etc. See sample below

Archives.create("test.jar", JavaArchive.class)
               .addClasses(
                     GreetingManager.class,
                     GreetingManagerBean.class);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM