Modifying existing jar file, how?

Hi there,
I have a problem trying to modify an existing jar file. When I want to create a jar file, I use something like:
REM build the application on windows, assuming the java/bin
REM directory is in the path environment variable
REM application is just the directory I am using
SET cp = c:\application\TestApp
javac -classpath %cp% TestApp.java
REM ****************************************
REM do packaging and adding manifest
REM ****************************************
jar cvfm App.jar manifest.mf TestApp*.class
REM ****************************************
REM run the jar file
REM ****************************************
javaw -jar App.jar
But now, I have an existing jar file (swingall.jar) and I want to modify a class within that file. So, I modified the .java file, and compiled it to get my new class file.
And the question is, how do I modify the existing file, so that I keep everything the same, except the modified class?
Thanks
Fernando

I have just found out that I can't use "u". It seemsthat's only
possible with older versions of jar.Huh? I'm using the 1.4.2-b28 jdk, it's still there,
and I don't see how it could ever possibly be
removed.
Type:
jar
with no arguments to see all the options to jar.I already did, to double check it, and this is what I got:
C:\Documents and Settings\Fernando Sanz>jar
Usage: jar {ctx}[vfm0M] [jar-file] [manifest-file] files ...
Options:
-c create new archive
-t list table of contents for archive
-x extract named (or all) files from archive
-v generate verbose output on standard error
-f specify archive file name
-m include manifest information from specified manifest file
-0 store only; use no ZIP compression
-M Do not create a manifest file for the entries
If any file is a directory then it is processed recursively.
The manifest file name and the archive file name needs to be specified
in the same order the 'm' and 'f' flags are specified.
Example: to archive two class files into an archive called classes.jar:
jar cvf classes.jar Foo.class Bar.class
Note: use the '0' option to create a jar file that can be put in your CLASSPATH
Thanks for trying with jdk 1.4, I don't have it installed in my computer right now, so I'll try tomorrow with another computer at Uni.
Thanks!

Similar Messages

  • How to append existed jar file?

    do existed jar file be append again?
    example:
    a.jar // existed jar file
    xyz // forlder that want append to a.jar

    you mean you want to add a directory full of class files to the existing .jar file?
    check the .jar file usage options.
    c:\> jar -helpDiablo

  • How to set new value for the existing jar file

    Help:
    I am wondering if there is a simple to update value for Manifest-Version in a existing jar file?
    Thanks!

    The jar command's -u option is about as easy as I know.
    See the jar command documentation for the details.

  • Problem when modifying the jar file of a portal component

    I get the umelogonbase.jar from the com.sap.portal.runtime.logon component, extract it with winzip, do not make any changes to the source code, then re-create the jar file and add it back to the component. Now, when I deploy the component to the Portal I get the following error:
    "Portal Runtime Error
    An exception occurred while processing a request for :
    iView : N/A
    Component Name : N/A
    com/sap/security/core/logonadmin/IAccessToLogic.
    Exception id: 10:30_08/08/07_0012_15067450
    See the details for the exception ID in the log file"
    any idea what I am doing wrong here?
    I am doing this because I need to change the texts in the umelogonbase.jar, so this is the first step to see that the component still runs once I modify the jar file.
    Note: I create the jar file by creating a jar-type project in NWDS and then exporting the project as jar.

    Do you have JDK installed? If not then please install it by downloading from http://java.sun.com/j2se/1.4.2/download.html. Install it in your local machine. Then inside the installation folder\bin folder you will find the jar.exe.
    Also create the environment parameter named JAVA_HOME and set the value as the installation directory of JDK for example JAVA_HOME=C:\j2sdk1.4.2_13. Also add the following to your Path environment variable
    C:\j2sdk1.4.2_13\bin;C:\j2sdk1.4.2_13\lib;
    these path names should vary depending upon your actual JDK installation folder name.
    Regards,
    Shubho

  • How to modify the jar files information for Script Assets??

    Hi,
    I am using Open Script 9.2. We can add the external JAR files using Script->Script Properties--> Script Assets. I need to change the jar files when ever i am going to execute no of scripts. How can I modify them using JAVA Coding without manual handling. Is there any specific methods existed in OpenScript to serve the above scenario.
    Thanks in Advance.
    Thanks & Regards,
    Siva Thota

    Hi,
    When you say alter the jar file, do you mean alter the contents of the java code within the jar. If this is yes then the simple answer is no. As you are probably aware, a jar file contains pre-compiled java code, which you will not be able to alter. What is it you are trying to achieve?
    A simple answer maybe to use a child script which you can include into your main script. You can then change the code in the child script, and when you play back, this 'new' code will be compiled, and included within the replay.
    Regards
    Wayne.

  • Modify existing excel file (POI API)

    Hi All,
    Can anybody give me a reference to an example to update/modify an exsiting excel file in java.
    For creation of excel file I am using POI API. But not getting how to update an existing excel file
    using POI API.
    I'll be thankful for your help.
    Regards
    Naz

    Tabbasum wrote:
    Hi All,
    Can anybody give me a reference to an example to update/modify an exsiting excel file in java.
    For creation of excel file I am using POI API. But not getting how to update an existing excel file
    using POI API.
    I'll be thankful for your help.
    Regards
    NazYou do know that the poi.apache.org site has some nice examples, don't you?
    http://poi.apache.org/spreadsheet/examples.html
    Many other examples exist on the Internet; Google is your friend.
    Hope that helps, Naz.
    Regards,
    Jay-Z

  • Executable jar files how ??

    How do I make a jar file executable, I know I have to modify manifest file but how??

    Include this line in the Manifest file
    Main-Class: MainClass.class
    Relplace the MainClass with the name of ur class.

  • In .jar file how can I call API's of other .Jar file

    Hi all,
    I have created a "MyApplication.jar" file that dose not need any other .jar file Like xercesImpl.jar thne it is working fine.
    but If I make the .jar file of application that needs xercesImpl.jar API's
    of this .jar file then how I can call that xercesImpl.jar in my Application.jar newly created.
    please help me
    Thanks in advance.

    either add the other jar file to your classpath or do the following (taken from http://javaalmanac.com/egs/java.lang/LoadClass.html)
    e68. Loading a Class That Is Not on the Classpath
    A URLClassLoader can be used to load classes in any directory.
        // Create a File object on the root of the directory containing the class file
        File file = new File("c:\\myclasses\\");
        try {
            // Convert File to a URL
            URL url = file.toURL();          // file:/c:/myclasses/
            URL[] urls = new URL[]{url};
            // Create a new class loader with the directory
            ClassLoader cl = new URLClassLoader(urls);
            // Load in the class; MyClass.class should be located in
            // the directory file:/c:/myclasses/com/mycompany
            Class cls = cl.loadClass("com.mycompany.MyClass");
        } catch (MalformedURLException e) {
        } catch (ClassNotFoundException e) {
        }

  • Java class uses another class in a Jar file (How do I make Java see it)?

    I am trying to figure out how do I make Javac see the thinlet.class in the thinlet.jar.
    I have developed an XUL xml interface and a java program that calls the interface shown below:
    //package thinlet.demo;
    import thinlet.*;
    public class UI extends Thinlet
    { public UI () throws Exception {add(parse("UI.xml"));}
    public static void main(String[] args) throws Exception
    { new FrameLauncher("UI", new UI(), 600, 600); }}
    when I do the normal compile, I get an error:
    UI.java:4: cannot find symbol
    symbol: class Thinlet
    public class UI extends Thinlet {
    ^
    UI.java:7: cannot find symbol
    symbol : method parse(java.lang.String)
    location: class thinlet.demo.UI
    add(parse("UI.xml"));
    ^
    UI.java:12: cannot find symbol
    symbol : class FrameLauncher
    location: class thinlet.demo.UI
    new FrameLauncher("UI", new UI(), 600, 600);
    ^
    3 errors
    This thinlet class should be in the thinlet.jar that I have added the directory to the path, the directory and jarfile name to the System CLASSPATH and it couldn't see it. So finally I tried putting the thinlet.jar in the same directory to no avail. I've searched the web for some time an cannot find anything that specifically speaks to compiling a program that has parent classes in a Jar.
    Any help is definitely appreciated.

    This thinlet class should be in the thinlet.jar that I have added the directory to the path, the directory and jarfile name to the System CLASSPATH and it couldn't see it. So finally I tried putting the thinlet.jar in the same directory to no avail. I've searched the web for some time an cannot find anything that specifically speaks to compiling a program that has parent classes in a Jar.
    Any help is definitely appreciated.You just still haven't provided the jar in the classpath, or you're not using the right class name. Is the class really named thinlet.Thinlet? Or are you thinking "import thinlet.*" means to import all classes in a jar named thinlet.jar? Because the latter is not true. You need to import classes, not jar file names.

  • Wls1032_generic (64bit) jar file how i can install ?

    operating system : windows 7 (64bit)
    oracle : 11gr2 (64bit)
    no java intstall
    any body can tell me how i can setup this jar file

    Hi,
    First of all you need to install 64 bit jdk either Sun jdk or Jrockit jdk as the generic jar files doesnt have one.
    Then you need to set the java home i.e. it should point to the 64 bit jdk.
    check java -version gives the o/p for the 64 bit jdk and then execute the command:-
    java -jar -d64 wls1032_generic.jar/zip
    Regards,
    Rohit Jaiswal

  • Viewing Jar File - How?

    Hi....I hope this is the right place to ask. My professor sent me a JAR file, but I have no idea how to open it. I have JarInspector, and it lists all these other files. When I doubleclick on the JAR file, IMPVIEWER opens, I get the first page, and that is it. (the JAR file is going to look like a powerpoint presentation with audio and video). I also have Java Web Start.
    Thanks!
    Scott

    Hmm, normally double-clicking on a jar file runs the Main-Class defined in the jar's manifest. If it's not working, you may not have the right version of Java or your prof may not have set up the jar correctly.
    Try opening a Terminal, cd'ing to the folder containing the jar, and running it directly. ie,
    cd ~/Desktop
    /usr/bin/java -jar somejarfile.jar
    If you get an error about incorrect class versions, upgrade Java to the latest available version (java.com).

  • Updating an existing .jar file

    I have downloaded the .class files of servlet2.3 . I have successfully archived the .class files which is under javax.servlet.* package.However, i am unable to understand how do i add the .class files which are under javax.servlet.http. package to the same archive.
    Where do i place the already created .jar file. Please give me the exact syntax.
    I placed my .jar file under http folder and ran the command jar cvfu Servlet.jar *.class but it did not work.
    Thanks!
    Jayashree

    I assume that there is :
    - a jar file that you wanna update with a newer class file
    - a class file that you wanna use to update the jar file
    you must copy the yourjarfile.jar in your home directory :
    cp anydirectory/yourjarfile.jar /home/yourdirectory/
    then you must uncompress it by :
    cd /home/yourdirectory
    jar -xf yourjarfile.jar
    then you must copy the newer class file that you have compiled in the good subdirectory that has been created while uncompressing yourjafile.jar
    cp directorywhereyouclassfileis/yourclassfile.class subdirectorycreatedwhileuncompressing/
    then you can update you jar file by :
    jar -uf directorycreatedwhileuncompressing/yourclassfile.class yourjarfile.jar
    You can then verify that is has just been updated by :
    jar -tvf yourjarfile.jar -->verify the date/time to check
    hope it helps...
    bye

  • Since downloading firefoz 4, everytime I make a browser search I get a second page with :"Firefox can't find the file at jar:file://how can I solve the problem. Kindly reply to :ramses1@videotron.ca

    Question
    firefox 4, when I make a browser search I get a second page:"Firefox can't find the file at jar:file:///D:/Program Files/Mozilla Firefox/omni.jar!/chrome/browser/content/browser/<url></url>", how can I solve the problem.

    Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    See:
    * [[Troubleshooting extensions and themes]]

  • When you've created a jar file, how do you use images in your program

    i want to be able to play a game with a jar file, but the image path file gets screwed up

    >
    i want to be able to play a game with a jar file, but the image path file gets screwed up>To get a reference to a resource isnide a Jar file?
    URL url = Thread.
      currentThread().
      getContextClassLoader().
      getResource("path/to/the/image.gif");Where path/to/the/image.gif is the relative path within the Jar.
    As an aside, JAI is a separate API for doing advanced stuff with images, and it supports image formats unknown to the J2SE. Whereas your question was better suited to a 'New to Java' style group, especially since it seemed the question had to do with paths, more than images as such.

  • When I search using my address bar it comes up and say page not found jar file, how do I fix this?

    File not found
    Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/chrome/en-US/locale/browser-region
    Check the file name for capitalization or other typing errors.
    Check to see if the file was moved, renamed or deleted.

    hello Kygirl, please install the search reset addon - it will revert the most common customziations those adware programs do in firefox back to the default (including the keyword search from the location bar): https://addons.mozilla.org/firefox/addon/searchreset/

Maybe you are looking for

  • Workable Task?:  AirPort Express "g", Time Capsule, Panasonic VieraCast

    I have been at this for a few hours, a wall has been the result for a bit of the process. I have the following: iMac Airport Express "g" series (circa 2004?) Time Capsule 1TB (bought yesterday) Panasonic TV (TC-P50G15) with Viera Cast (bought two wee

  • Bridge fails to connect to blackberry email

    Playbook has been connecting to blackberry pearl emails for months, but has suddenly failed. Still connects to pearl contacts, tasks, memo pad etc, but when it tries to connect to pearl emails, it fails to populate and just flashes on and off with gr

  • RV_PRICE_PRINT_HEAD not returning all output conditions

    Hi experts, I am using the FM 'RV_PRICE_PRINT_HEAD' to get the header conditions but it is returning only specific condition types. I need all the header conditions maintained in the sales order. Is it possible to get all conditions through this FM ?

  • The Maverick maps has stopped working on my imac

    About two weeks ago the Maps app on my 27 inch iMac started to crash shortly after starting up. Now it just bounces a couple of times and then nothing more. How do I fix this?

  • Graph applet

    hello, i wish to draw a line graph in a certain region(ex. rectangle),even when exceeds the dimentions of the rectangle i want to display the current plot... for ex. http://java.sun.com/products/java-media/2D/samples/java2demo/Java2Demo.html in Arcs_