Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2007

Tip: Looking for answers? Try searching our database.

Create a jar file from within

Thread view: 
Grzesiek - 14 Aug 2007 15:17 GMT
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 :-)
Thomas Fritsch - 14 Aug 2007 15:43 GMT
Grzesiek:
> I have 2 files in my project : App.java and Foo.java. App is the main
> class.
[quoted text clipped - 7 lines]
> 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.

Signature

Thomas

Grzesiek - 14 Aug 2007 15:59 GMT
> Grzesiek:> I have 2 files in my project : App.java and Foo.java. App is the main
> > class.
[quoted text clipped - 13 lines]
> --
> Thomas

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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.