Closed TCreutzenberg closed 3 years ago
It should default to jre
if it wasn't specified.
Fixed with 4.0.1-SNAPSHOT and 4.1.0-SNAPSHOT.
Hi @TCreutzenberg, thanks for the bug report. Could you explain how you got this exception? Did you pass a JSON config file to Packr, or did you use command line arguments?
@petoncle Hey there, the deployment porcess for my LibGDX project has quite a few steps, so I created an extra packr-module in my project and I have a class there which does all the things (packing texture atlas, build jar, etc.) and in the end runs Packr. This allows me to step-dubug any problems.
final PackrConfig config = new PackrConfig(); config.platform = platform; config.jdk = projectDirectoryPath + "\packr\openjdk\" + OPEN_JDK_NAME; config.executable = "Game name"; config.classpath = Arrays.asList(projectDirectoryPath + "\desktop\build\libs\desktop-" + Settings.VERSION + ".jar"); // config.removePlatformLibs = config.classpath; config.mainClass = "path.to.DesktopLauncher"; config.vmArgs = Arrays.asList("Xmx1G"); config.minimizeJre = minimizeConfigPath; // config.cacheJre = // config.resources = Arrays.asList(new File("")); config.outDir = new java.io.File(outputDirectory); // config.platformLibsOutDir = ; // config.iconResource = ; // config.bundleIdentifier = ; config.verbose = true; config.useZgcIfSupportedOs = true; config.jrePath = "jre";
new Packr().pack(config);
Thanks a lot for the info! I was wondering how you got an exception since config.jrePath
can never be null when it is run via the main() method in Packr.java. But I see that you're using it as a library and instantiating your own PackrConfig.
@karlsabo I'm fine with the fix (https://github.com/libgdx/packr/commit/28fe04bffae926de39014b04a0e53f929bb5f435) but I just wanted to point out that having a default jrePath value in Packr::writeConfig
is not consistent with the other config parameters:
jrePath
is now the only config parameter that has a default value implemented in Packr::writeConfig
PackrCommandLine
and in Packr.DEFAULT_JRE_PATH
Maybe it would be better to start defining default values in PackrConfig directly (instead of in PackrCommandLine and in Packr)?
Packr 4.0.0:
In the Packr class
Line 374:
PackrFileUtils.copyDirectory(jre, new File(jreStoragePath, config.jrePath));
a NullPointerException is thrown if config.jrePath is not set (or null).
According to the README.md "config.jrePath" is optional:
jrePath (optional) | path to the bundled JRE. By default, the JRE will be placed in a folder called "jre".
Took me quite some time to figure out what's wrong.
Nevertheless: Thank you very much for Packr!