The Wiert Corner – Jeroen Pluimers’ irregular stream of Wiert stuff

on .NET, C#, Delphi, databases, and personal interests

  • Twitter Updates

  • My work

  • My badges

  • My Flickr Stream

    DSC_4321

    DSC_4304

    DSC_4301

    More Photos
  • Pages

  • All categories

Batch file for modifying .properties file in JAR Java ARrchive file

Posted by jpluimers on 2009/07/06

I needed to quickly edit one .properties file in multiple versions of the same JAR file.

So I write the batch-file below, that presumes

  • you have 7-zip installed in the default directory on your system.
  • the batch-file is in the same directory as the .JAR file

The batch file uses the original JAR file SEALS_Server.jar, creates a new JAR file SEALS_Server-logging.jar that contains the file logging.properties having one line with the setting level = INFO.

set target="%~dp0SEALS_Server-logging"
set JAR=..\SEALS_Server-logging.jar
set compress="%ProgramFiles%\7-Zip\7z.exe"
mkdir %target%
cd %target%
%compress% x ..\SEALS_Server.jar
echo level = INFO> logging.properties
del %JAR%
%compress% a -r -tzip -mx9 %JAR% .
cd ..
rd /s /q %target%
pause

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>