My current attempt is:
File executionDir = new File("").getCanonicalFile();
ApplicationInfo info = ApplicationRegistry.getApplicationInfoByDir(executionDir);
return info.getVersion();
It works, but I wonder if there is a way to get at the information without making any assumptions about the current working directory?
You can query the sys.version
compiler variable:
import com.install4j.api.launcher.Variables;
try {
String version = Variables.getCompilerVariable("sys.version");
} catch (IOException e) {
// TODO not running in installation
}