1

Recently I encountered a problem when using exe4j to package the jar into exe. My xml configuration file is placed in the same directory of the exe, but after the package is completed, the exe will look for the xml file from the temporary folder. These are the instructions in the exe4j help documentation

For some applications (especially GUI applications) you might want to change >the working directory to a specific directory relative to the executable, for >example to read config files that are in a fixed location. To do so, please >select the Change working directory to: checkbox and enter a directory relative >to the executable in the adjacent text field. To change the current directory >to the same directory where the executable is located, please enter a single >dot.

The error when i running the exe :

[ERROR] In Log's init,cann't read config file, file=/C:/Users/**/AppData/Local/Temp/e4jEA8.tmp_dir1543543191//sys_log.xml

Why is the program not looking for this xml from the exe's sibling directory, and how can I find it from this directory?

  • Thank you for your enthusiasm, my problem has been solved by using another version V5.0.1, it can read files directly from the same directory of exe. – user10725565 Dec 11 '18 at 05:32

1 Answers1

0

If you are using the "JAR in EXE" mode, use

System.getPrpoerty("install4j.exeDir")

to get the parent directory of the executable.

Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102