Search code examples
javalaunch4j

How to tell my java exe to read a ini file in same folder?


I have a jar that I run this from command line

java -jar -Djava.util.logging.config.file=logging.properties AddNUmbers-1.0.jar "3" "5"

I changed jar to an exe using launch4j-Maven-Plugin like this AddNumbers.exe . now the command line looks like this

AddNumbers "3" "5"

But I dont have -Djava.util.logging.config.file=logging.properties in there and I lost ability to log things. Saw an example out which was using ini to pass that in but not sure how to tell my exe to look for it.

Anyone ran into similar thing and have got by it in past of having exe read ini file that has JVM arguments needed at runtime


Solution

  • After going thorough documentation on launch4j website I found it we want to pass JVM arguments at runtime we need to create file with same name and ".l4j.ini" extension in same folder as the exe.

    So create a file with AddNumbers.l4j.ini and in it putting

     -Djava.util.logging.config.file=logging.properties
    

    resolved my situation