packr: Packr-generated exe prints nothing, does nothing
I’m unsure what’s causing this, but after running Packr with the command line
java -jar packr.jar -platform windows -jdk "C:/Users/user/.lein-packr-cache/windows.zip" -executable perlin -appjar "target/perlin-0.0.1-SNAPSHOT-standalone.jar" -mainclass "perlin/core/desktop_launcher" -minimizejre "hard" -resources resources -outdir out-win32
it successfully generates an exe in the directory out-win32. Running this exe in the Windows 7 64-bit command prompt with no args causes nothing to be printed, and it immediately closes. Double clicking the exe causes the cursor on Windows 7 to show the spinning circle next to it for a few seconds, but opens no windows. What could cause this?
The JDK I’m using is from the recommended unofficial builds project (zip file link). I can run the jar with java -jar perlin-0.0.1-SNAPSHOT-standalone.jar and it displays a libgdx window and renders some perlin noise. This problem with the packed output happens whether -minimizejre is set or not, and I suspect it may be related to finding the main class, or to the structure of the unofficial build zips changing. The demo is written in Clojure using the play-clj binding to libgdx, and I was able to run Packr 1.0 on Clojure apps before, so I suspect something broke in the meanwhile. I tried this with the latest Packr link available in the Readme, and programatically with the 1.2 version on Maven Central (more on that in a bit). I did modify the soft and hard profiles as I mentioned in a comment on #18 . The non-working exe and working jar are bundled here, with a jre from Packr, so you can inspect it more closely.
I am also trying to make a plugin for the Clojure build tool called Leiningen, so it can use Packr to bundle JREs as part of a build step. My code for this plugin (which is in Clojure, but very small right now) is available on my Github. Generating anything programatically suffered the same fate as running Packr manually.
I’m at a loss for what to do here. The output it generates is totally normal:
Unpacking JRE
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
copying resources
minimizing JRE
unpacking rt.jar
packing rt.jar
Done!
But of course, it generates an exe that doesn’t do anything. Does anyone have an idea what could be wrong, and whether it’s on my side or a bug with Packr?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 32 (17 by maintainers)
I ran into the same problem. To make clearer @so3arbelnox’s fix, here’s the story: when you build an executable standalone jar with Eclipse, if you select “Package required libraries into generated JAR” Eclipse nests the libraries jars into it, and adds a
jar-in-jar-loader.zipjar to somehow be able to read their content. I believe packr-generated executables do not like that, so you need to extract the library jars into your standalone jar, which is what Eclipse’s “Extract required libraries …” option does.