This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Need Help on :: Programatically Creating Jar file From Existing Jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need Help on :: Programatically Creating Jar file From Existing Jar file " Watch "Need Help on :: Programatically Creating Jar file From Existing Jar file " New topic
Author

Need Help on :: Programatically Creating Jar file From Existing Jar file

vijay kurhade
Greenhorn

Joined: Mar 02, 2009
Posts: 2
I am trying to create dummy jar file based on existing jar file; using java.util.Jar package classes like JarFile, JarOutputStream, Manifest class objects.


What I am tryig to do is

I have A.jar file
read A.jar; JarFile
get its manifest object with JarFile.getManifest()

manifest.put("READER", "MyName");

If i specify this manifest in
JarOutputStream(outputstream, manifest);

Get ZipException -> Duplicate META-INF\META-INF.MF entry



What is the best way to achieve creating copy of one jar to another with slight change to manifest file.


Help is Appreciated
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38107
    
  22
Easiest done from the command line, I would think. There should be something in the Java Tutorials; there is a section about modifying the manifest file.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8806
    
    5
intermediate level


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need Help on :: Programatically Creating Jar file From Existing Jar file
 
Similar Threads
creating jar file programatically
Executable Jar and Class-Path
Question about Jar file
Manifest file not working in J2EE project?
creating jar using java.util.jar