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

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top