Quantcast
Channel: Java – The Wiert Corner – irregular stream of stuff
Viewing all articles
Browse latest Browse all 65

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

$
0
0

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

Posted in CommandLine, Development, Java, Software Development

Viewing all articles
Browse latest Browse all 65

Trending Articles