Unzipping a jar file

how do Unzip a jar file?

You can unjar a file giving
" jar -xvf filename.jar " at the command prompt if u don't have a jar.exe please try using winzip/unzip..
ebistro

Similar Messages

  • Some prolems when trying to create Jar file...

    Hi,
    1st sorry i post this in the wrong box, i posted it in the Jar box but no body replied and I really need to get this done soon...
    I've got a list of *.class and a folder images and Start is the class I want to be the entry point
    I tried:
    1. jar cfm MyApp.jar Manifest.txt *.class images
    In Manifest.txt has a line: Main-Class: Start
    the jar file is created, but when I tried to run (both double click and command line) this gives me an error "Failed to load Main-Class manifest attribute from..."
    2. jar cmf MyApp.jar Manifest.txt *.class images
    this has error while making the jar file, it gives "java.io.FileNotFoundException: MyApp.jar (The system cannot find the file specified)...
    3. I tried the 1st method, then unzip the jar file, edit the manifest.mf file by adding a line Main-Class: Start. Then zip it, rename it to MyApp.jar
    And a weird thing happens... When I place the jar file IN THE SAME FOLDER with other class files, it runs fine. But when I move it to A DIFFERENT FOLDER with other class files, it runs with dimension 0x0, i.e. only the title bar is displayed...
    I've tried those method and none of them work... can some one tell me what I have done wrong?
    Thanks...

    This is the class used to get the ImageIcon for the JLabel
    public class CardGUI extends JPanel {
         private ImageIcon tmp;
         private final int CARDWIDTH = 50; //Card width is 50
         //return the Card GUI
         public ImageIcon getCardGUI (int kind, char suit) {
              //This String is used to locate the file (*.png)
              //of each Card
              //E.g. Card 2 Club will has file "images/cards/2c.png"
              String imgStr = "images/cards/" + kind + suit + ".png";
              tmp = new ImageIcon(imgStr);
              //If the card is not found, return the back of the Card
              if (tmp.getIconWidth()!= CARDWIDTH) {
                   tmp = new ImageIcon("images/cards/back.png");
              return tmp;
    }Then the JLabel used this to set the image, where humanCard1 is an instance of JLabel, and cardLabel is instance of the above class.
    humanCard1.setIcon(cardLabel.getCardGUI(card10.getKind(), card10.getSuit()));
    > new ImageIcon("images/mainbackground.jpg")Wrong. Because there are any more no files in a jar archive. Only file is the jar file itself, and nothing else.
    What do u mean? When I create the jar file, i include the images folder inside the jar file already?
    I've been using the Swing forum and that's how I know the 2 methods above for setting image for JLabel and JPanel... So what should i be searching for in the Swing forum now?

  • JAR files and getResource()

    Hello i have the following piece of code in class x.y.z.Tester:
    String rootPath = this.getClass().getResource("/").getPath();          
    System.out.println(rootPath);which prints the path where the x.y.z.Tester class is located on my FS.
    for example if my class is store at:
    C/folder_1/bin/x/y/z/Tester.class
    the returned path would be:
    C:/folder_1/bin
    Now, when I bundle this class (along with others) in a JAR file and set the x.y.z.Tester as the main class and run it, i get this error:
    Exception in thread "main" java.lang.NullPointerException
    at com.nortelnetworks.productsupportability.netrx.service.report.generator.Tester.<init>(Tester.java:9)
    at com.nortelnetworks.productsupportability.netrx.service.report.generator.Tester.main(Tester.java:35)
    On line 9 is the first line of code above.
    On line 35 is the call to the method that has line 9.
    However, the funny thing is that when I unzip (or extract) the contents of my JAR file, the it works fine and returns the path where the x.y.z.Tester is stored.
    Now, I would like to have this work without having to unzip the JAR file. does anyone know if any issues or why the "getResource()" method returns a NullPointerException if it's JAR'ed.
    thank you,

    Not sure what your goal is, but try this.
    import java.net.URL;
    import java.security.CodeSource;
    import java.security.ProtectionDomain;
    public class CodeSourceExample {
        public static void main(String[] args) {
            CodeSourceExample object = new CodeSourceExample();
            Class cls = object.getClass();
            ProtectionDomain domain = cls.getProtectionDomain();
            CodeSource source = domain.getCodeSource();
            URL location = source.getLocation();
            System.out.println(location);
    }

  • Executable jar files and manifest file

    Hi,
    I have the following files in a folder named: Test
    a.jar
    b.jar
    c.jar
    Driver.class
    Driver.mf
    Here, MainClass is the main executable class that uses a,band c.jar files. This is how my MainClass.mf file looks:
    Manifest-Version: 1.0
    Main-Class: Driver
    Class-Path: a.jar b.jar c.jar
    Now I use the following command to make one executable jar file:
    jar cmf Driver.mf DriverMain.jar *
    It creates an executable jar file named : DriverMain.jar
    Now I copy the executable jar file (DriverMain.jar) into a different folder named: RunTest
    and double click it, doesn't work.
    my question is:
    what am I doing wrong? Any special characters needed in my Driver.mf file (space/newline/etc)?
    What I am trying to get is: One execuatble jar file so I can just double click to run it, and that single executable jar file will have all the necessary jars in it (i.e. a.jar, b.jar, c.jar in this case)
    Anyone please help!
    Thanks
    -Ron

    Rony,
    Sorry to disappoint, but you can not use embeded jar/zip files within an executable jar. The JDK sadly for some reason decided this was not a useful idea, so developers like me who want to distribute plugins with thier own dependencies have one of two choices. You either have to unzip the jar file that contains the embeded jars to a directory, then run your primary exectuable jar, OR you have to write a custom classloader that your "launcher" creates then loads the embeded jar files.
    The best thing to do is either jar up a, b, c and driver into one jar, so that it works, if you can legally do this. A lot of 3rd party libraries may not allow this per their license. Otherwise, another choice is to use a free installer or buy an installer that allows you to distribute a single exectuable installer program that will properly create the dir structure you need.
    As for the way it works, if you declare:
    Class-Path: a.jar b.jar c.jar
    the JAR loader code in the JDK looks in the root dir where your application was started for a/b/c jar files. They have to be on disk.
    If you want to place them in /lib, for example, you would havd a jar file like:
    Driver.class
    Driver.mf
    lib/a.jar
    lib/b.jar
    lib/c.jar
    When unzipped, your "root" dir would look exactly like the above, and your manifest would have Class-Path using ./lib/a.jar ./lib/b.jar ./lib/c.jar
    Anyway, there thus far isn't any way around this issue of embeding jar files in an executable jar file. You MIGHT be able to not specify any classpath, then in your Driver.class, create a new custom classloader that dervies from URLClassLoader, but in the findClass(), you get a ref to the .jar file that the classloader class is inside of, and from that use it to find the lib/*.jar files and add them to the classpath. For this to work, however, your Driver.class code should ALSO be contained in an embeded jar file that is loaded by this custom loader. The only thing Driver.class would contain (and I would rename it to something like Launcher) is the code to create the custom classloader.
    It's fun stuff, but a little bit of work to make it work. You can infact make it work! I may yet one day take our plugin engine custom loader and create a way for this to work!

  • How to run a jar file

    hi
    can anybody tell me how to run a jar file in java,is there any need to unzip a jar file before running it?
    Thanks in advance.

    Set the classptha, if you want to run it by double clicking.
    I assume that you know, how to set the classpath.I though that if it is an executable jar, the classpath environment variable will be completely ignored. Are you saying something to the contrary?

  • Problems Signing a Jar File.

    Hi Everyone
    I'm having problems signing a jar file.
    The applet in the jar file was previously signed by Duke.
    Now I want to re-sign it with my company name.
    So I unzip the jar file. I was careful to remove the manifest and the Duke .sa and .rsa. I re-signed it with the netscape signtool.
    The applet works. It presents the prompt that it is signed by my company. I grant session. Then another prompt appears and it says it is signed by duke.
    but i was careful to remove the duke signature and manifest file when i unzipped it. Is it possible that the fact that it is signed by duke is stored in the bytecode ??
    It is using the <object tag by the way.
    <OBJECT classid="clsid:CAFEEFAC-0013-0001-0002-ABCDEFFEDCBA"
         WIDTH = "100%" HEIGHT = "50" border="0"
         codebase="http://www.homework911.com/java/j2re-1_3_1_02-win.exe#Version=1,3,1,2">
         <PARAM NAME = "CODE" VALUE = "com.s.SApplet"/>
         <PARAM NAME = "CODEBASE" VALUE = "/_phone"/>
         <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.3"/>
    stev

    great suggestion - there are no other signed jar files on the browser for it to access. There is a winzip file but it has no rsa/dsa and signature file in it.
    perhaps it is accessing something else that was signed by duke ?
    Would it be possible for it to connect to a server program that was signed by duke and therefore present the prompt. ?
    I'm trying to get the original unsigned classes and see if i can recompile and sign it just in case then name duke is in byte code.
    any other thoughts as to what this code be ?
    stephen

  • Protect jar file from unzip utility

    Hi
    I have an application in .jar file and I don't want that the client
    can extract or unzip and see the contents of my .jar file.But still the .jar file
    could run by mouse double click or java -jar command.
    Anyone can give me an idea how to do it.
    Thanks...

    If java can read it on your client's machine, the client can read it. There is no way to prevent this. Here's the general cycle:
    int protectionMode = chooseProtectionMode();
    boolean haveCustomers = true;
    while (haveCustomers)
      switch (protectionMode)
        case OBFUSCATE: 
          //You can obfuscate your code to make it (marginally) harder to
          //reverse-engineer.  If your client is really interested in your
          //code, this won't keep them from figuring out what it does.
          break;
        case ENCRYPT:
          // You can encrypt most of your class files, and build a
          // decrypting classloader, and build a framework that calls
          // the decrypting classloader to get at the rest of the jar. 
          // Of course, your client can just arrange to call your
          // classloader from their own, and write the (decrypted)
          // classfiles to disk, and then reverse engineer them.
          protectionMode = OBFUSCATE;
          break;
        case STATECHECK:
          // You can put some kind of check in your decrypting classloader
          // that calls System.exit() if it discovers it's being called in
          // such an unfriendly way.  Your client will take about 10 minutes
          // to find and remove the check.
          protectionMode = ENCRYPT;
          break;
        case REMOTE:
          // You can keep your code on your server and let the client run
          // something that talks to it.  The client will complain
          // vociferously, and refuse to use your app. 
          haveCustomers = false;
          break;
        default:
          // You can decide to stop stressing over something you can't
          // help, and write code that people will buy
      }(Sorry - in an odd mood, seen this question or one like it too often recently, not enough sleep...)

  • Unzipping jar files

    i all i have downloaded the apache package to upload files using jsp/servlets. it is a jar file and i placed it in the lib(WEB-INF/lib) directory. my program that calls the package is in the /WEB-INF/classes file and when i try to compile the file i get errors because the program is unable to locate the apache package which is in a jar format. what do i need to do to make use of that package? do i need ot unzip the package or give some kind of class path to the jar file while compiling? please help

    you just need to make sure that the apache .jar file is on the classpath when you try to compile your classes.
    you will also need it on the classpath at runtime.

  • Help:how to use java.util.jar to zip or unzip a binary file.

    how to use java.util.jar to zip or unzip a binary file or a file contain native code.

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • To how unzip trsuted applet jar file

    hi to all,
    I have created a trusted applet signed jar file.Now now i want to unzip the this jar file..but i am unable to do it......
    so please help me
    Thanks and Regards

    Yes, I thought you would not like that answer. If you want a better answer, ask a better question. Provide useful information like what you have tried, what error messages you are getting, and so on. "I am unable to do it" is not useful information.

  • NEED HELP PLEASE!!!!  Not unzipping but executing .jar file on iPhone

    I am in need of help, Please, there has to be someone who knows how to do this!
    OK On iphone 4s, I used winzip to extract a .jar file but I am unable to open and use the actual file.
    This was expensive purchase and this is a time issue.
    Thank You Very Much!!!!

    You can't, .jar is a Java archive, iOS doesn't have a java virtual machine.

  • Can not open JAR file?

    Hello,
    My friend and I are working on a Calculus Project in which he made a Java applet that shows how a function's derivative is found... regardless! He made this file on a Linux based computer and saved it as a .jar file and sent to me via email. I downloaded the file and double clicked it, but the file didnt open, instead it displayed this message:
    "The Java JAR File "Calc_Deriv.jar" could not be launched.
    Please check the console for possible errors"
    I checked the console, and to be honest I had absolutely no clue what I was looking at. Here were the messages from the last 10 minutes.
    Code:
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] SystemFlippers: didn't consume all data for long ID 0 (pBase = 0x10012fc90, p = 0x10012fc94, pEnd = 0x10012fc98)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] SystemFlippers: didn't consume all data for long ID 0 (pBase = 0x1001116f0, p = 0x1001116f4, pEnd = 0x1001116f8)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] Exception in thread "main"
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] java.lang.NoClassDefFoundError: org/jdesktop/application/SingleFrameApplication
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.lang.ClassLoader.defineClass2(Native Method)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.lang.ClassLoader.defineClass(ClassLoader.java:774)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:160 )
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.net.URLClassLoader.defineClass(URLClassLoader.java:254)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.security.AccessController.doPrivileged(Native Method)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    12/15/09 6:01:11 PM [0x0-0x10d10d].com.apple.JarLauncher[3275] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    I do not know where to start, nor where to end, nor what I am looking for. But essentially I simply need to open this file and see what is inside.
    --System--
    Model Name: MacBook Pro
    Model Identifier: MacBookPro4,1
    Processor Name: Intel Core 2 Duo
    Processor Speed: 2.4 GHz
    Number Of Processors: 1
    Total Number Of Cores: 2
    L2 Cache: 3 MB
    Memory: 2 GB
    Bus Speed: 800 MHz
    Boot ROM Version: MBP41.00C1.B03
    SMC Version (system): 1.27f2
    Serial Number (system): W8**T1YJX
    Hardware UUID: 9FC62D3C-021A-5C2A-9197-134226381FE9
    Mac OSX 10.5.8
    Thank you very much for the help!

    In a Terminal session you could try something like
    unzip -l path/to/jar/file
    Dave

  • Error while compiling Web Dynpro program due to missing JAR files

    Hi Experts,
    I am getting error message while compiling Web Dynpro program. The erring lines are as below:
              Message message = new MimeMessage(session);
              try {
                   message.setFrom(new InternetAddress(fromMailId));
                   message.addRecipient(
                        Message.RecipientType.TO,
                        new InternetAddress(toMailId));
                   message.setSubject(mailSubject);
                   message.setText(mailBody);
                   message.setHeader("X-Mailer", "E-Mail");
                   message.setSentDate(new Date());
                   Transport.send(message);
    The error messages are:
    Message.ReceipientType can not be resolved
    The method send(Message) is undefined for the type Transport
    The method setFrom(InternetAddress) is undefined for the type Message
    The method setHeader(String, String) is undefined for the type MessageThe method setSentDate(Date) is undefined for the type Message
    The method setSubject(String) is undefined for the type Message
    The method setText(String) is undefined for the type Message
    Type mismatch: cannot convert from MimeMessage to Message
    Can you please help me in resolving the issue. It seems that some API is missing. I believe if some one can tell me the name of JAR file / API then I will be able to sort out the issue. I will add these JAR file in my program.
    Thanks,
    S

    HI Stuart,
    you are missing the jar files required for sending mail in java
    Installing JavaMail
    You will need the latest version of JavaMail (Version 1.2) available here:
    http://java.sun.com/products/javamail/
    Download and unzip the file, in the newly created top level JavaMail directory you will find a number of jar files,
    these need adding to your classpath.
    To do this in Eclipse, right click on your project in the tree view, select properties, select the libraries tab.
    Now click the 'Add external jars' button, navigate to your JavaMail directory and click on the jars.
    The tutorial also makes use of the Java Activation Framework, which is available here:
    http://java.sun.com/products/javabeans/glasgow/jaf.html
    Instalation of JAF is identical to JavaMail
    activation.jar / mail.jar are 2 distinct names i remember rest you will get above
    P.S: close the question to assist other users narrow the search and find solutions
    Message was edited by:
            Armin Reichert

  • Problem with images in .jar file

    Hi all!
    I've got a severe problem when deploying an application via web start:
    the images withhin a deployed .jar file are not found.
    So far I've tried a number of things to get the images back, none of which are working.
    I've found different threads concerning this topic, e.g.:
    http://forum.java.sun.com/thread.jspa?threadID=396363
    http://forum.java.sun.com/thread.jspa?threadID=465795&messageID=2141351
    but sadly, they didn't help me out.
    Here is my code I'm using:
      private ImageIcon loadIconFromClassLoader(String tszRelPath)
        ImageIcon tIcon = null;
        cCat.info("tszRelPath = "+ tszRelPath);
        // this line simply leads to a crash of the whole application
        //tszRelPath = tszRelPath.replaceAll("\\", "/");
        if(!tszRelPath.startsWith("/"))
          tszRelPath = "/" + tszRelPath;
        cCat.info("modified tszRelPath = " + tszRelPath);
        URL tURL = ClassLoader.getSystemResource(tszRelPath);
        if(tURL == null)
          // this too crashes my application
          //tURL = PlainResourceProvider.class.getResource(tszRelPath);
        if(tURL != null)
          tIcon = new ImageIcon(tURL);
        return tIcon;
      }I've also tried
    PlainResourceProvider.class.getClassLoader().getResource()PlainResourceProvider is part of the .jar that involves the images.
    Of course all the .class files in the .jar file are easily accesible
    I would be so thankful, if just anyone could help me to solve this problem.
    I am going crazy.
    Thanks in advance, Christoph

    You should take care of the directory structure according to the package structure.
    I for example have this jar:
    C:\source\java\ebank2_util\smsunlock>unzip -l pro-ebank_sms_unlock.jar
    Archive:  pro-ebank_sms_unlock.jar
    Length    Date    Time    Name
          0  10-28-05  17:27   hu/
          0  10-28-05  17:27   hu/khb/
          0  10-28-05  18:17   hu/khb/smsunlock/
        256  11-07-05  16:33   hu/khb/smsunlock/DButils$MySQLException.class
       4229  11-07-05  16:33   hu/khb/smsunlock/DButils.class
       1700  11-07-05  16:33   hu/khb/smsunlock/GUI$1.class
       2318  11-07-05  16:33   hu/khb/smsunlock/GUI$2.class
        988  11-07-05  16:33   hu/khb/smsunlock/GUI$3.class
       1402  11-07-05  16:33   hu/khb/smsunlock/GUI$mywl.class
       5630  11-07-05  16:33   hu/khb/smsunlock/GUI.class
        818  11-07-05  16:33   hu/khb/smsunlock/LimitedLength_TextField.class
       2452  11-07-05  16:33   hu/khb/smsunlock/Main.class
        900  11-07-05  16:33   hu/khb/smsunlock/MyInputStream.class
          0  11-07-05  16:33   META-INF/
         98  10-27-05  15:53   META-INF/manifest.mf
         90  11-07-05  16:33   hu/khb/smsunlock/properties
      20881                    16 filesAnd the resource is loaded like this from hu.khb.smsu.Main:
    InputStream is = new MyInputStream( Main.class.getResourceAsStream( "properties" ) );

  • Extract JAR file to a different directory

    Is it possible to use the jar command to extract the content of a JAR file to a different directory (not the current directory)?
    I want to use this command inside a makefile, looking for the same effect as "unzip example.jar -d directory".
    Thanks in advanced.

    Thanks Chuck, you solved my doubt... It surprises me that JAR doesn't support this option.
    I used the "unzip" command inside the makefile instead, but I wanted to be sure that there wasn't any chance to use "jar" (without using the additional script file).

Maybe you are looking for

  • Please provide the patch set for Oracle Enterprise Manager Grid Control 10

    Hi, please provide the patch set for Oracle Enterprise Manager Grid Control 10.2.0.1 and 10.2.0.5 for AIX 5.3 patch set for Oracle Enterprise Manager Grid Control for 11.2.0.2 OS AIX 5.3 Thanks, Vishal Hande.

  • Tomcat and apache mod_jk or mod_webapp

    Hello,I am using linux and I am running a apache web server and I also use tomcat. I have upgraded from tomcat 4.0 to 4.1.24 and I am now wanting to use servlets and jsp with apache.I have messed around with servlet etc for awhile now but I wish to u

  • Search for Printer Driver for Canon MPC190S

    Hi, I am facing a problem in getting my Mini to print on my existing printer (Canon MPC 190S). Called up Local Canon Support, saying that they dont Support Mac system. Anyone can help me out on advise on how to get the driver? Thanks Mac Mini   Mac O

  • Action script _root.attachMovie

    Hi all!  I have a big problem at work. Here is the situation.  I have an html passing a variable as an array to my flash.  In the flash i want to call a couple of symbols depending on the variable from html and display them as a slideshow. I need to

  • 'Unsupported color space' nonsense

    Hi all, I have Photoshop CS2, 9.0.2 and I'm still getting 'can't open file because it uses an unsupported color space' error when I try to edit a graphic object from Acrobat. Is there any way around this problem? Thanks!