Björn Kautler - 2018-04-05

After a bit IDA Pro disassembling and gdb debugging I think I found the two issues I had. The first was misconfiguration by me, the second probably a programming bug in head.c.

The misconfiguration was that I used <classPath><cp>classpath-lib/*.jar</cp></classPath> and <jre><opt>--module-path</opt><opt>lib</opt></jre> instead of <classPath><cp>%EXEDIR%/classpath-lib/*.jar</cp></classPath> and <jre><opt>--module-path</opt><opt>%EXEDIR%/lib</opt></jre>. This cause the directories to be searched for in the working directory, not in the EXE directory which made the difference between calling from Explorer and calling from commandline which I did not do in the directory where the EXE resides.

This leads to the second error, the one in head.c. As the <classPath><cp/></classPath> setting pointed to a wrong path, the _findfirst(cp, &c_file) call in head.c:1051 cannot find anything for the wildcard. The line 1070 which is *(launcher.args + strlen(launcher.args) - 1) = 0; should remove the last semicolon from the added classpath if I understand it correctly. The problem is, that if no paths were found, instead the opening double quote is removed which then results in only the closing double quote be present which then makes up the invalid command line.