Create a jar file from within

G

Grzesiek

Hi,

I have 2 files in my project : App.java and Foo.java. App is the main
class.

In App.java i have a line:

Runtime.getRuntime().exec("jar cfe Foo.jar Foo Foo.class");

Then, I created a jar file App.jar

Running App.jar creates Foo.jar. But Foo.jar contains only manifest
file and no class. What is wrong?

Thnax in advance :)
 
T

Thomas Fritsch

Grzesiek:
I have 2 files in my project : App.java and Foo.java. App is the main
class.

In App.java i have a line:

Runtime.getRuntime().exec("jar cfe Foo.jar Foo Foo.class");

Then, I created a jar file App.jar

Running App.jar creates Foo.jar. But Foo.jar contains only manifest
file and no class. What is wrong?
Are you running that on Java1.6 and Solaris?
Earlier Java-versions or other platforms don't support the "e" flag.
 
G

Grzesiek

Grzesiek:> I have 2 files in my project : App.java and Foo.java. App is the main





Are you running that on Java1.6 and Solaris?
Earlier Java-versions or other platforms don't support the "e" flag.

Hi Thomas,
I use java1.6 and Windows. But i think it is not the case here. The
project is created in NetBeans 5.5.1 and App.jar is also created in
NetBeans. I think that Foo.class created in NetBeans as a part of App
Project is not the same as Foo.class created by "javac Foo.java"
although Foo.java is the same. I doubt wheather Foo.class created in
Netbeans can be used like this:

jar cfe Foo.jar Foo Foo.class

i.e without App.class

Thanx anyway :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top