Updating a specific file into a .jar file

Hi,
I have got a .jar file, if I want to update the specific file org/abc/try.class, with a new try.class, what command should I use?
thanks a lot.

Something like that, but remember you have to rebuild the entire jar file from scratch. You can't just update one file in it.

Similar Messages

  • Updating a properies file in a .jar file

    Hi
    I have an application that reads a properties file from a .jar file using the getSystemResourceAsStream method on the ClassLoader class. What I would like to be able to do is to change values in this properties file when the application exits so the next time into the application the last used values for certain text boxes are remembered from last time. Can anyone suggest a way to achieve this. I can write the properties file out using the FileWriter class and this works but I read it is not a good idea to use these classes for this purpose.
    Thanks in advance

    Those .properties files can perfectly be writting using a FileOutputStream
    (not a Writer). Updating a .properties file in a .jar file isn't possible
    without rewriting the entire .jar file.
    Your scenario should work fine: if the .properties file doesn't exist, get
    a "prototype" from the .jar file and store it as an independent file. Update
    this file using a FileOutputStream ad lib.
    kind regards,
    Jos
    ps. if you don't like this scenario, you could have a look at the Preferences class.

  • Including a rms file into a *.jar file

    Hi,
    I would like to know if it's possible to include a rms (RecordStore) into a jar file off a Midlet suite. I don't want to create the RecordStore everytime i need to install my application. I tryed to copy rms.db to the instalation dir and it worked but i have tools that allow me to do that. My possible clients don't, and i wish to include the rms in the instalation to jar in order to be transparent to them. Adding file to *.jar doesn't work, because the file remains inside the *.jar and isn't installed in the application dir.
    I appreciate some help
    Thank u and by the way
    MERRY CHRISTMAS

    Hi
    I'm not aware of any technique for directly loading an RMS via the JAR.
    Instead, have you considered using a resource file and initializing the RMS from that? Or initializing from a network connection? You could also use the optional properties in the JAD for key=value pairs.
    We have used all 3 techniques - including using the resource file as a default dataset and then relegating the RMS to holding any dataset updates.
    Happy New Year

  • Conversion of a .class file into a .jar file

    Conversion of a .class file into a .jar file
    How Will I convert a .class file into a .jar file.
    Pls answer ASAP.

    You don't.
    You add a .class file into a .jar file. You don't convert anything.
    Read the help page for jar for details.

  • Play WAV files into the .jar

    Hello,
    I'm doing small application Java with Netbeans.
    I need is to play .wav file sounds are incorporated into the jar.
    I do not want to use external libraries or external sound files, etc.. I want to go with my .JAR to the office, home, etc ... just need the JAR to hear the sounds.
    I've created a folder "Sounds" in "src" and in that place I have my sounds. (Project / src / sounds). It's a way to incorporate a JAR file, or am I wrong?? Run independently of the sound files.
    At the time of reproducing the sound I do the following:
    Clip sonido = AudioSystem.getClip();
    File f = new File(getClass().getResource(/Sonidos/alarma.wav).toURI());
    sonido.open(AudioSystem.getAudioInputStream(f));
    sonido.start();
    If I run the program with netbeans, I play sounds, but which only transfer my .JAR to another computer, does not play ...
    Any ideas?
    Thank's.

    I don't understand, before I had done as you have written me, but did not work, but now it works.
    Problem solved. Thank's.
    Posting the code here:
    InputStream path = getClass().getResourceAsStream("/Sonidos/alarma.wav");
    try
    sonido = AudioSystem.getClip();
    sonido.open(AudioSystem.getAudioInputStream(path));
    sonido.start();
    }catch(Exception fail)
    System.out.println(fail);
    Edited by: 892291 on 19-oct-2011 10:37

  • How to package other jar files into one jar?

    How to package other jar files into one jar? How can i get the class in the inner jar file?

    Generally not a good idea. The Java runtime won't be able to load classes from those "inner" jars, you'd have to write your own classloader to do that. It's not a brilliant idea, generally, anyway, since the point of having lots of jars is to keep your application modular. Bundling them all together like that means you have to re-deploy the whole thing to fix, for instance, one small bug in one small library
    If you really want to do this, there's an Eclipse plugin called FatJar, but I urge you to consider whether you really want to do it first.

  • Delta Update with flat file into infocube

    Hi
    Can any one explain me the steps how to achive the delta update with falt file into infocube?
    Thanks

    There is a documented way of managing a delta but it mostly boils down to how you model the process. SAP says you can add a ROcancel field ( or something similar to it) in the transaction data within the files
    that way when you update the data into the cubes, it would be managed - whether it has to be added or over written,
    therefore the best way to manage this would be to make some changes i the flat file-
    are the flat files being generated by some program? maybe you can add in further to check the updated records -

  • Beginner: Can't convert a hello.class file into a jar file: HELP PLEASE!!!

    Hi, I created a hello.java file, converted into a hello.class file by using the java 2SDk compiler. The problem is that the hello.class file is in a directory I created: C:\JavaBuilder\hello.class
    I have a problem converting the hello class file into a jar file. I don't know which approach to take. I've looked at tutorials...but I keep getting more confused each time I view the tutorials on creating jar files. Please can someone help..by taking me through a step by step process. Please be explicit and do not leave or assume that I know any details because I'm a new born beginner. Thank you very much, I seriously appreciate it.

    Hi i did as you suggested, only with these exceptions:
    jar -cvf hello.jar C:\JavaBuilder\hello.class
    I did this and got the message: "adding : C:\JavaBuilder\hello.class (in=1150) (out=708) (deflated=38%)"
    The problem is that when I tried to execute the jar file...by typing: " java -jar hello.jar" I received the error message: "Failed to load Main-Class Manifest attribute from hello.jar" Is there any way to correct this problem? please help, thank you.

  • How to add a directory into a jar file

    Hi, guys, I want to add a package into a jar file. For example, my dirctory structrue
    is org/test/, all files locate in the directory test, in org.test package. I want to
    add the package into a jar file, test.jar. I use "java -cvf test.jar -C org/test/ .
    But it says "jar: no match". How can I solve it.
    thanks

    Instead of 'java', use 'jar'.
    All in all, try this: jar cvf test.jar -C org/test/*.class.
    Have a nice day!

  • Beginner: Can't convert a hello.class file into a jar file. Please Help!!!

    Hi, I created a hello.java file, converted into a hello.class file by using the java 2SDk compiler. The problem is that the hello.class file is in a directory I created: C:\JavaBuilder\hello.class
    I have a problem converting the hello class file into a jar file. I don't know which approach to take. I've looked at tutorials...but I keep getting more confused each time I view the tutorials on creating jar files. Please can someone help..by taking me through a step by step process. Please be explicit and do not leave or assume that I know any details because I'm a new born beginner. Thank you very much, I seriously appreciate it.

    Hi!
    first of all, you should use an upper-case character for the first letter of your classes...
    To answer your question :
    1) you must create a directory named "meta-inf" in your directory "C:\JavaBuilder"
    2) then,you must create a file named "manifest.mf" in this directory
    it's like a property file and it must contain this :
    Main-Class: hello
    (don't forget to type <enter> after "hello")
    3) in the directory "C:\JavaBuilder", you can enter the following command :
    "jar cvfM hello.jar meta-inf\manifest.mf hello.class"
    (check jar.exe is in your path)
    4) you can run your jar by the command :
    "java -jar hello.jar"

  • Updating an XML file inside the executable JAR.

    Hello all!
    I would like to askk how can i update an XML file that is packaged inside my jar file?
    For intstance:
    I have a Java Application in NetBeans
    Inside a package i have constructed a custom .xml file.
    I can read from this file using
    .....getClass().getResourceAsStream("/.../file.xml")and after that using XPath for querying and works fine.
    I want to update an entry in my xml file so the jar contains now the newly updated file.
    Thanks everyone who spends hit time to read this. Hope someone can help me.

    Please don't cross-post:
    http://forums.sun.com/thread.jspa?threadID=5342194

  • Updating an XML file inside the Jar executable

    Hello all!
    I would like to ask how can i update an XML file that is packaged inside my jar file?
    For intstance:
    I have a Java Application in NetBeans
    Inside a package i have constructed a custom .xml file.
    I can read from this file using
    .....getClass().getResourceAsStream("/.../file.xml")and after that using XPath for querying and works fine.
    I want to update an entry in my xml file so the jar contains now the newly updated file.
    Thanks everyone who spends his time to read this. Hope someone can help me.

    Even if it were possible, it would be a bad idea. A jar file is something you deploy. It can be really hard to manage ongoing maintenance if the thing you deploy changes after you've deployed it.
    Just create a file, in an appropriate place given the user's OS, to hold data that changes after the jar has been deployed. Your application will still be in a single jar; it's just that the application will happen to create additional content outside the jar.

  • Need help: how to make a package into a jar file?

    I tried to make a package into a jar file by using:
    jar cf a.jar packagedirectory
    But when I import one class of this package in an other application, by using:
    javac -cp path\a.jar; app.java
    the compliler can not find the calss.
    The interesting thing is if I do not put the package into the jar file, it works well.
    Here is my sample code under path D:\b\b1
    package b1;
    public class Son
         int x = 10;
         public Son(){
         public int getX(){
              return x;
    and the application code under path d:\b
    import b1.Son;
    public class Father
         public Father(){
         public static void main(String[] args)
              Son son = new Son();
              System.out.println("Hello World!"+son.getX());
    Thanks for any advise.
    Xin Cheng

    You must make sure that you are in the right directory
    when you do your jar command to create the archive.
    [home/trejkaz/proj/test/classes]% jar -cf a.jar
    path/to/package/*.class
    Thank you very much.
    Yes, I did as what you said, but it does not work.
    Here is what I did:
    1. Edit Father.java in D:\b
    2. Edit Son.java in D:\b\b1
    3. Compile Son.java
    4. Complie Father.java
    5. Make the a.jar by
    command jar cf a.jar D:\b\b1\ (I cheked the content of the a.jar, it seems right.)
    a.jar is in directory D:\b
    6. Delete Son.class in D:\b\b1
    7. Run Father.class by
    command: java -classpath D:\b\a.jar; Father
    error message is: Exception in thread "main" java.lang.NoClassDefFoundError: b1/Son
    at Father.main(Father.java:11)
    What is the problem?
    Thanks again.

  • How to write the errors into a specific file

    Hi all,
    How to handled the errors in the scenarios,By using fault messages we can informed about errors to sender.But in my case i have to gather all errors & write into a specific file.For this can i create another Communication Channel for File reciever.How can i gather error messages in the scenario.
    Early response is appreciate

    Hi,
    Bhavesh had already answered how to handle it. For saving it in a file yes you can use File Receiver adapter.
    Regards,
    Prakash

  • How do I read the images I bundled into the jar file?

    I just wrote an applet that uses
         Toolkit tk = Toolkit.getDefaultToolkit();
         tk.getImage("blah.gif");to load a bunch of image files. The class file and gif images were bundled into a jar file to minimize the number of connections the browser has to make to the server.
    The applet works fine in appletviewer but trips a java.security.AccessControlException: access denied (java.io.FilePermission select.gif read) when run in a browser. I know you normally use Applet.getImage(URL) to load images but wont that circumvent the JAR file and make a seperate connection to the server for each image? That would defeat the purpose of using a JAR file.
    How do I access the image files I bundled into the JAR file?

    From your Applet class, write the following:
    URL imgUrl = getClass().getResource("blah.gif");
    Image img = getImage(imgUrl);The returned URL will be from the Applet class ClassLoader, which will look into the specified archive (jar) file.

Maybe you are looking for

  • Lost all my grouped tabs how do I get them back pls

    One minute all my tabs and group tabs were there and the next minute FFox wasn't running. I opened it again and just had the one tab open and the FFox start page. I went to restore the previous session and nothing happened. Pls can you tell me how I

  • Safari 7.0.2 opens multiple windows or tabs

    I have safari 7.0.2 and suddenly every link opens a new window or tab. I end up with multiple windows that I have to close. It did not do this before this week. Possibly related to osx10.9.2 update?? Anyone else experiencing this?

  • Multiple AM in CPX file - anyone got this to work ?

    Hi, It seems impossible to use multiple application modules from the same CPX file. For convenience reasons, I have many AM definitions in my CPX - (which the CPX wizard allows perfectly). I can create a first app module and it works perfectly. But w

  • Renaming Artist name for groups of songs.

    I listen to a lot of classical music. Here the artist name, composer name, and album name can all be screwed up between different music companies where one uses one company uses one field for the artist name and another for the composer name. The oth

  • How to retrieve GPS data?

    Hey Can anybody tell me if it is possible, in a generel way, to retrieve GPS positioning data? (and maybe post a link, where i can read more? ) MY test devicde is a SonyErikson W760, with a buidin GPS reciever! I searched a little, but i don't know t