Updating file in jar

Posted by / 28-Jun-2018 16:36

Updating file in jar

I think this answer would be a good answer to the question if you included some more of the details from your blog, within the answer itself so that someone reading your answer learns something even if they don't read the blog, or it gets moved to another URL at some future date.

In this command: The u option indicates that you want to update an existing JAR file.

Much better than making the whole jar all over again.

Invoking this from within your program sounds possible too.

Alternatively, you may want to actually not have these config files in the jar at all - if you're expecting to need to replace these files regularly, or if it's supposed to be distributed to multiple parties, the config file should not be part of the jar at all.

File i want to modify are configuration files, mostly xml based.

If you want to modify the file, you must read out all of the entries, modify the one you want to change, and then write the entries back into the jar file.

I have had to do this before, and that was the only way I could find to do it.

We'll cover the basics of using the JAR tool before delving a bit deeper into some more extended offerings of the tool later in this article.

I have file and have few packages inside this jar file. Example - Packages inside - search , util Classes inside search package - - Need to edit this code and need to make a new jar file. Let's start with, noramlly Jars don't contain files, nothing saying that they can't, just normally, they don't.

updating file in jar-86updating file in jar-11updating file in jar-6

The Java Archive Tool, which ships with the Java Development Kit, can be invoked using the jar command.