Synesso
Synesso

Reputation: 38988

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.*.

Upvotes: 1

Views: 615

Answers (4)

Aravind Yarram
Aravind Yarram

Reputation: 80194

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);

Upvotes: 0

user330315
user330315

Reputation:

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...

Upvotes: 2

hhafez
hhafez

Reputation: 39780

I'm not sure what you mean by "creating a jar file" but ant has a jar task which will create a jar file for you

Upvotes: 3

Related Questions