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.
[sourcecode language=”delphi”]
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
[/sourcecode]






Leave a Comment