Results 1 to 4 of 4
- 08-04-2011, 11:06 PM #1
Unpacking a jar file using pack200
I am trying to unpack a jar file using pack200 but cannot figure out what i am suppose to have in the input stream.
Java Code:import java.io.*; import java.util.jar.*; public class test { public static void main(String args[]) throws IOException{ String userName = System.getProperty("user.home"); File outName = new File(userName +"/Desktop/test.jar"); File inName = new File(userName + "/Desktop/tmp"); Pack200.Unpacker unpacker = Pack200.newUnpacker(); JarOutputStream out = new JarOutputStream(new FileOutputStream(outName)); InputStream in = new FileInputStream(inName); unpacker.unpack(in, out); out.close(); } }I know from previous experiences that (Is a directory) means that the path needs to be something other than a directory but what does the path need to be for the pack200 to work?Java Code:Exception in thread "main" java.io.FileNotFoundException: /home/***/Desktop/tmp (Is a directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:137) at test.main(test.java:10)
- 08-04-2011, 11:43 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,539
- Rep Power
- 11
The exception is saying that there is a problem with the FileInputStream constructor rather than anything to do with Pack200. The File argument must name a readable file.
Check that /home/***/Desktop/tmp exists (including spelling and case), is a file and is readable. Do this from the command line or within the code using the appropriate File methods.
- 08-05-2011, 02:48 AM #3
i took your suggestion, as well as i could understand, and created a file.txt in the tmp directory re wrote the path and now it is giving me a new error
Java Code:Exception in thread "main" java.io.IOException: Corrupted pack file: magic/ver = 00000000/0.0 should be CAFED00D/150.7 OR CAFED00D/160.1 at com.sun.java.util.jar.pack.NativeUnpack.start(Native Method) at com.sun.java.util.jar.pack.NativeUnpack.run(NativeUnpack.java:186) at com.sun.java.util.jar.pack.NativeUnpack.run(NativeUnpack.java:235) at com.sun.java.util.jar.pack.UnpackerImpl.unpack(UnpackerImpl.java:121) at test.main(test.java:11)
- 08-05-2011, 03:38 AM #4
Similar Threads
-
the mp3 file is not working..java.io.IOException: File Not Found......javax.media.NoP
By shruts in forum Java AppletsReplies: 1Last Post: 07-28-2011, 07:50 PM -
Write a program that sorts data from a text file and sort them in a file
By danmgz45 in forum New To JavaReplies: 6Last Post: 12-01-2010, 05:31 AM -
pack200 .gz file unpack and create .jar file in browser(speed test).
By maheshsardar in forum Java AppletsReplies: 1Last Post: 08-04-2010, 03:24 PM -
Sending a File from Server to Client and saving the file to Clients computer
By al_Marshy_1981 in forum NetworkingReplies: 8Last Post: 02-18-2010, 12:54 PM -
how to read openproj(Projity) file i.e. ,POD file(Project Management file)
By mahendra.athneria in forum New To JavaReplies: 0Last Post: 02-11-2009, 09:53 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks