Code Monkey home page Code Monkey logo

packr's Introduction

About

Packages your JAR, assets and a JVM for distribution on Windows, Linux and macOS, adding a native executable file to make it appear like a native app. Packr is most suitable for GUI applications, such as games made with libGDX.

On the topic of games, Packr version 2.4.2+ supports Java 14 and the Z garbage collector has been verified to work. Because who doesn't want GC pause times guaranteed to not exceed 10ms with work in progress for sub 1ms GC pauses. When bundling Java 14+ make sure to use --useZgcIfSupportedOs instead of passing --vmargs XX:+UseZGC because versions of Windows before Windows 10 1803 are not supported by the Z garbage collector.

Starting with Java 14, there's a new tool that is included with the JDK called jpackage. There's a lot of overlap between jpackage and packr. Considering jpackage is supported by the broader OpenJDK community, it's worth looking into. It might be a better solution for your product. There's also Conveyor which can build self-updating packages, do signing and notarization, and cross-build (Windows/Mac packages from Linux, Linux/Mac from Windows etc). It's free for open source projects but requires payment for commercial projects.

Download

The latest build is available for download here.

Resource artifacts are available at Maven Central

Usage

You point packr at your JAR file(s) containing your code and assets, some configuration parameters, and a URL or local file location to a JDK build for your target platform.

Invoking packr from the command line may look like the following. For a more complete example look at the PackrAllTestApp/packrAllTestApp.gradle.kts:

java -jar packr-all.jar \
     --platform mac \
     --jdk OpenJDK11U-jre_x64_mac_hotspot_11.0.10_9.tar.gz \
     --useZgcIfSupportedOs \
     --executable myapp \
     --classpath myjar.jar \
     --mainclass com.my.app.MainClass \
     --vmargs -Xmx1G \
     --resources src/main/resources path/to/other/assets \
     --output out-mac
Parameter Meaning
platform one of "windows64", "linux64", "mac"
jdk Directory, zip file, tar.gz file, or URL to an archive file of a JRE or Java 8 JDK with a JRE folder in it. Adopt OpenJDK 8, 11, and 15 are tested against https://adoptopenjdk.net/releases.html. You can also specify a directory to an unpacked JDK distribution. E.g. using ${java.home} in a build script.
executable name of the native executable, without extension such as ".exe"
jrePath (optional) path to the bundled JRE. By default, the JRE will be placed in a folder called "jre".
classpath file locations of the JAR files to package
removelibs (optional) file locations of JAR files to remove native libraries which do not match the target platform. See below for details.
mainclass the fully qualified name of the main class, using dots to delimit package names
vmargs (optional) list of arguments for the JVM, including leading dashes, e.g. "-Xmx1G"
useZgcIfSupportedOs (optional) When bundling a Java 14+ JRE, the launcher will check if the operating system supports the Z garbage collector and use it. At the time of this writing, the supported operating systems are Linux, macOS, and Windows version 1803 (Windows 10 or Windows Server 2019) or later."
resources (optional) list of files and directories to be packaged next to the native executable
minimizejre (optional) Only use on Java 8 or lower. Minimize the JRE by removing directories and files as specified by an additional config file. Comes with a few config files out of the box. See below for details on the minimization config file.
output the output directory. This must be an existing empty directory or a path that does not exist. Packr will create the directory if it doesn't exist but will fail if the path is not a directory or is not an empty directory.
cachejre (optional) An optional directory to cache the result of JRE extraction and minimization. See below for details.
icon (optional, OS X) location of an AppBundle icon resource (.icns file)
bundle (optional, OS X) the bundle identifier of your Java application, e.g. "com.my.app"
verbose (optional) prints more status information during processing, which can be useful for debugging
help shows the command line interface help

Alternatively, you can put all the command line arguments into a JSON file which might look like this:

{
    "platform": "mac",
    "jdk": "/Users/badlogic/Downloads/OpenJDK8U-jdk_x64_mac_hotspot_8u252b09.tar.gz",
    "executable": "myapp",
    "classpath": [
        "myjar.jar"
    ],
    "removelibs": [
        "myjar.jar"
    ],
    "mainclass": "com.my.app.MainClass",
    "vmargs": [
       "-Xmx1G"
    ],
    "resources": [
        "src/main/resources",
        "path/to/other/assets"
    ],
    "minimizejre": "soft",
    "output": "out-mac"
}

You can then invoke the tool like this:

java -jar packr-all.jar my-packr-config.json

It is possible to combine a JSON configuration, and the command line. For single options, the command line parameter overrides the equivalent JSON option. For multi-options (e.g. classpath or vmargs), the options are merged.

This is an example which overrides the output folder and adds another VM argument. Note that the config file name is delimited by -- because the option prior to it, --vmargs, allows multiple arguments:

java -jar packr-all.jar --output target/out-mac --vmargs -Xms256m -- my-packr-config.json

Finally, you can use packr from within your Java code. Just add the JAR file to your project, either manually, or via the following Gradle dependency:

repositories {
   mavenCentral() // Packr artifacts will be published to Maven Central in the future
   maven(uri("https://oss.sonatype.org/content/repositories/snapshots/")) // Packr snapshot artifacts will be published to Maven Central in the future

   // The following repositories are available until artifacts can be published to Maven Central
   maven(uri("http://artifactory.nimblygames.com/artifactory/ng-public-snapshot/"))
   maven(uri("http://artifactory.nimblygames.com/artifactory/ng-public-release/"))
}
dependencies {
   implementation("com.badlogicgames.packr:packr:3.0.3")
}

To invoke packr, you need to create an instance of PackrConfig and pass it to Packr.pack():

PackrConfig config = new PackrConfig();
config.platform = PackrConfig.Platform.Windows32;
config.jdk = "/User/badlogic/Downloads/openjdk-for-mac.zip";
config.executable = "myapp";
config.classpath = Arrays.asList("myjar.jar");
config.removePlatformLibs = config.classpath;
config.mainClass = "com.my.app.MainClass";
config.vmArgs = Arrays.asList("-Xmx1G");
config.minimizeJre = "soft";
config.outDir = new java.io.File("out-mac");
config.useZgcIfSupportedOs = true;

new Packr().pack(config);

macOS notarization and entitlements

The following entitlements when signing the PackrLauncher executable are known to work on macOS 10.15 (Catalina) and Java 14.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.cs.allow-jit</key>
	<true/>
	<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
	<true/>
	<key>com.apple.security.cs.disable-executable-page-protection</key>
	<true/>
	<key>com.apple.security.cs.disable-library-validation</key>
	<true/>
	<key>com.apple.security.cs.allow-dyld-environment-variables</key>
	<true/>
</dict>
</plist> 

If all the bundled dylibs are signed, fewer entitlements might be possible. When using Java 8, com.apple.security.cs.allow-unsigned-executable-memory, and com.apple.security.cs.disable-executable-page-protection were not needed.

Example macOS code signing and notarization command line steps

These steps assume you have an Apple developer account, have saved your Apple code signing certificate into Keychain and have generated an app-specific password for your Apple developer account, allowing you to pass your username and token as command line arguments. The example commands also assume you saved the app-specific password in your Keychain allowing these commands to run in an automated way, e.g., your CI pipeline can execute all these commands.

  1. codesign --sign <keychain id for certiticate> --verbose=10 --timestamp --force --options runtime --entitlements <path-to-entitlements-file> <path to exe or shared lib>
  2. /usr/bin/ditto -c -k --keepParent <app path> <app path>.zip
    • ditto is a commandline zip tool, any tool that creates a zip file from a directory can be used.
  3. xcrun altool --notarize-app --verbose --primary-bundle-id com.mydomain.myproduct --username '<username>' --password "@keychain:<app-specific password>" --file <app path>.zip
    • If this step fails, it will exit with a non-zero return code and provide good output as to why it failed. E.g., "You must first sign the relevant contracts online."

Optional steps, you can choose to wait for an email notification

  1. xcrun altool --notarization-history 0 -u <username> -p "@keychain:<app-specific password>" --output-format xml
    • This command grabs the history for the last call to xcrun altool --notarize-app, this will obviously fail if you're running multiple xcrun altool --notarize-app processes in parallel. You'll have to come up with a better way to parse the history.
  2. Parse the XML output for the last request UUID, regex: <string>(.*?)</string>
  3. In a loop, every minute check the notarization status.
    • xcrun altool --notarization-info <parsed uuid> -u <username> -p "@keychain:<app-specific password>"
  4. Parse the output for the status, regex: .*?Status:\s+(.*?)$
  5. When the status no longer matches in progress exit the loop.
  6. If the Status did not end up as success the output will provide a description of what went wrong.
  7. xcrun stapler staple --verbose <app path>

Minimization

Unless you're stuck with using Java 8, it's best to create a minimized JRE using jlink. See TestAppJreDist/testAppJreDist.gradle.kts for an example Gradle build script which generates JREs from downloaded JDKs.

JRE

A standard OpenJDK 8 JRE is about 91 MiB unpacked. Packr helps you cut down on that size, thus also reducing the download size of your app.

To minimize the JRE that is bundled with your app, you have to specify a minimization configuration file via the minimizejre flag you supply to Packr. A minimization configuration is a JSON file containing paths to files and directories within the JRE to be removed.

As an example, have a look at the soft profile configuration:

{
  "reduce": [
    {
      "archive": "jre/lib/rt.jar",
      "paths": [
        "com/sun/corba",
        "com/sun/jndi",
        "com/sun/media",
        "com/sun/naming",
        "com/sun/rowset",
        "sun/applet",
        "sun/corba",
        "sun/management"
      ]
    }
  ],
  "remove": [
    {
      "platform": "*",
      "paths": [
        "jre/lib/rhino.jar"
      ]
    },
    {
      "platform": "windows",
      "paths": [
        "jre/bin/*.exe",
        "jre/bin/client"
      ]
    }
  ]
}

This configuration will unpack rt.jar, remove all the listed packages and classes in com.sun.* and sun.*, then repack rt.jar again. By default, the JRE uses zero-compression on its JAR files to make application startup a little faster, so this step will reduce the size of rt.jar substantially.

Then, rhino.jar (about 1.1 MiB) and, in the JRE for Windows case, all executable files in jre/bin/ and the folder jre/bin/client/ will be removed.

Packr comes with two such configurations out of the box: soft and hard. The hard profile removes a few more files, and repacks some additional JAR files.

The "removelibs" option

Minimization aside, packr can remove all dynamic libraries which do not match the target platform from your project JAR file(s):

platform files removed
Windows *.dylib, *.so
Linux *.dll, *.dylib
MacOS *.dll, *.so

This step is optional. If you don't need it, just remove the configuration parameter to speed up packr. This step doesn't preserve the META-INF directory or files in the jar.

Caching

Extracting and minimizing a JRE can take quite some time. When using the cachejre option, the result of these operations are cached in the given folder, and can be reused in subsequent runs of packr.

As of now, packr doesn't do any elaborate checks to validate the content of this cache folder. So if you update the JDK, or change the minimize profile, you need to empty or remove this folder manually to force a change.

Output

Windows

When packing for Windows, the following folder structure will be generated

outdir/
   myapp.exe
   myjar.jar
   myapp.json
   jre/

Linux

outdir/
   myapp
   myjar.jar
   myapp.json
   jre/

Mac OS X

outdir/
   Contents/
      Info.plist
      MacOS/
         myapp
      Resources/
         myjar.jar
         myapp.json
         jre/
         icons.icns [if config.icon is set]

You can further modify the Info.plist to your liking, e.g. add icons, a bundle identifier etc. If your output folder has the .app extension it will be treated as an application bundle by Mac OS X.

Executable command line interface

By default, the native executables forward any command line parameters to your Java application's main() function. So, with the configurations above, ./myapp -x y.z is passed as com.my.app.MainClass.main(new String[] {"-x", "y.z" }).

The executables themselves expose an own interface, which has to be enabled explicitly by passing -c or --cli as the very first parameter. In this case, the special delimiter parameter -- is used to separate the native CLI from parameters to be passed to Java. In this case, the example above would be equal to ./myapp -c [arguments] -- -x y.z.

Try ./myapp -c --help for a list of available options.

Note: On Windows, the executable does not show any output by default. Here you can use myapp.exe -c --console [arguments] to spawn a console window, making terminal output visible.

Building from source code

If you want to modify the code invoke Gradle.

$ ./gradlew clean assemble

This will create a packr-VERSION-all.jar file in Packr/build/libs directory, you may invoke as described in the Usage section above.

Gradle project structure

The Gradle build is set up as a multi-project build. In order to fully build the multi-project you must have a compatible JRE (Java 8+) and C/C++ build tools that the Gradle build can find.

DrOpt Gradle sub-project

This is a downloaded and unzipped https://github.com/jamesderlin/dropt/releases version 1.1.1 source code with a Gradle script used to build it for consumption by the PackrLauncher Gradle project. The DrOpt source required a few modifications to get it compiling, namely some explicit casting in the C code.

Packr Gradle sub-project

This is the Java code for creating application bundles that can use the native launcher executables. This project also builds the packr-all uber/shadow jar that works as an executable jar.

PackrLauncher Gradle sub-project

This contains the platform native code for loading the JVM and starting the packr bundled application.

PackrAllTestApp Gradle sub-project

This is an example Hello world style application that bundles itself using packr and is used as a high level test suite to help reduce breaking changes.

TestAppJreDist Gradle sub-project

This project downloads JDKS 8, 11, and 14 and runs jlink on the 11 and 14 versions to create minimal JREs for use by PackrAllTestApp.

Limitations

  • Only Adopt OpenJDKs 8, 11, and 15 are tested (other JDKs probably work)
  • Icons aren't set yet on Windows and Linux, you need to do that manually.
  • Minimum platform requirement on MacOS is OS X 10.10 (Only 10.15 macOS Catalina is actively tested, there are users that report 10.14 works).
  • JRE minimization is very conservative. Depending on your app, you can carve out stuff from a JRE yourself, disable minimization and pass your custom JRE to packr. If you're using Java 11+ you should create a JRE using jlink.
  • On MacOS, the JVM is spawned in its own thread by default, which is a requirement of AWT. This does not work with code based on LWJGL3/GLFW, which needs the JVM be spawned on the main thread. You can enforce the latter with adding the -XstartOnFirstThread VM argument to your MacOS packr config.

License & Contributions

The code is licensed under the Apache 2 license. By contributing to this repository, you automatically agree that your contribution can be distributed under the Apache 2 license by the author of this project. You will not be able to revoke this right once your contribution has been merged into this repository.

Security

Distributing a bundled JVM has security implications, just like bundling any other runtimes like Mono, Air, etc. Make sure you understand the implications before deciding to use this tool. Here's a discussion on the topic.

packr's People

Contributors

badlogic avatar bitbrain avatar cmiles74 avatar code-disaster avatar cypherdare avatar darkyenus avatar dsaltares avatar erodozer avatar frosty-j avatar jrenner avatar karlsabo avatar likfe avatar maximtwo avatar mikehearn avatar mikosik avatar nathansweet avatar nedtwigg avatar santoszv avatar stevenmz avatar tduccuong avatar the-alchemist avatar thotep avatar titovmaxim avatar tommyettinger avatar ukeller avatar zalewa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packr's Issues

Allow packr without JRE

Would really like a way to package an application that uses the system JRE instead of packing a minimized version. This way I can instead require users to have Java installed and reduce the size of my application.

Minimizing error

Hi guys:

I'm receiving this error message using openjdk-1.7.0-u60-unofficial-windows-i586-image.zip with soft profile:

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 detail
s.
copying resources
minimizing JRE
unpacking rt.jar
Exception in thread "main" java.io.FileNotFoundException: File does not exist: o
ut4\jre\lib\rt\com\sun\corba \se
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1386)
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
        at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
        at com.badlogicgames.packr.Packr.minimizeJre(Packr.java:194)
        at com.badlogicgames.packr.Packr.pack(Packr.java:153)
        at com.badlogicgames.packr.Packr.main(Packr.java:302)

I'm receiving another error message using openjdk-1.7.0-u60-unofficial-windows-i586-image.zip with hard profile:

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 detail
s.
copying resources
minimizing JRE
unpacking rt.jar
Exception in thread "main" java.io.FileNotFoundException: File does not exist: o
ut4\jre\lib\rt\com\sun\jndi \url
        at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1386)
        at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
        at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
        at com.badlogicgames.packr.Packr.minimizeJre(Packr.java:194)
        at com.badlogicgames.packr.Packr.pack(Packr.java:153)
        at com.badlogicgames.packr.Packr.main(Packr.java:302)

Without minimizing I don't receive any error. Have I to use another jdk/jre?

Best regards!

DEB Installation Package Suggestion

Just as a suggestion, but for Linux (or more precisely anything Debian based like Ubuntu) maybe one could also choose between zip and deb packing. Deb package files are very common for most Linux distributions, and definitely most that gamers are going to use (mainly Ubuntu).

Again, just a suggestion. I may try to work on this myself as well.

Missing msvcp110.dll and msvcr110.dll on Windows.

The generated .exe launcher produce an errors about missing msvcp110.dll and msvcr110.dll on some Windows installations. I think it is better to avoid such dependencies. There are two ways to solve it, First - put both files in the application folder.

Second (a better alternative in my opinion) is to link the launcher statically with them. The latter is achieved by using /MD key in Configuration Properties > C/C++ > Code Generation > Runtime Library according to:
http://stackoverflow.com/questions/21103532/msvcp110-dll-how-do-i-get-around-it

I'm using the latter one and it works with no problems. The reason I have not prepared a PR is that an icon is important in .exe. And to get the icon one should compile the .exe on it's own and do not use auto generated launcher.

It doesn't show gui on windows 10 -> Issue with dependencies

I can't get it to work now, I used to deploy this way last year and now I can not, maybe I am doing something wrong anyway.

My program runs, but the gui won't show up. It runs in background and I can see the process in the task manager and it even creates some folders so it is running, but nothing on screen. If I click on the .jar file it works perfect.

Last thing I did was to build latest fork from @code-disaster ( v2 sqash ), redownloaded openjdk and even updated .json files according to that specific fork branch, and same thing:

See a picture of my config
http://i.imgur.com/kGaZyzZ.png
(i also tried windows32 with the corresponding openjdk, version 45 and also version 80)
Thanks

target to mac failed to load/find main class

hello,

I have simple config file:

{
"platform": "mac",
"jdk": "/Users/piotrek/Documents/dev/packr/openjdk-1.7.0-u80-unofficial-macosx-x86_64-image.zip",
"executable": "myapp",
"classpath": [
"desktop-1.0.jar"
],
"mainclass": "pl/edu/piotrekuczy/desktop/DesktopLauncher",
"vmargs": [
"-Xmx1G"
],
"minimizejre": "soft",
"outdir": "out-mac"
}

and after all myapp can't find a mainclass:

Exception in thread "main" java.lang.NoClassDefFoundError: IllegalName: pl/edu/piotrekuczy/desktop/DesktopLauncher
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:655)
at java.lang.ClassLoader.defineClass(ClassLoader.java:794)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
Error: failed to load/find main class pl/edu/piotrekuczy/desktop/DesktopLauncher
logout

what is wrong?

Run via Gradle

So, I'm currently porting my LibGDX project over to Gradle. Would it be possible to run this small but awesome tool via Gradle on the Buildserver? Possibly as a desktop:distJRE task or something like that. The alternative would obviously be to just run the command, but I thought that maybe there is a better way of doing this.

Windows 64bit support

Maybe my search skills are inexistent, but I can't find any issue about this.

Why there isn't any Windows 64bit version? I saw that @code-disaster submitted a build script that compiled it, but then removed it on a commit titled Oops...

Is there something missing to support this?

Using the current directory as -outdir causes all files in it to be deleted

I ran with this command line

java -jar packr-1.1-SNAPSHOT-jar-with-dependencies.jar -platform windows -jdk openjdk-1.6.0-unofficial-b30-windows-amd64-image.zip -executable blade -mainclass com.example.App -appjar target\App.jar -outdir .

I got

Exception in thread "main" java.io.IOException: Unable to delete file: .\packr-1.1-SNAPSHOT-jar-with-dependencies.jar
    at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1390)
    at org.apache.commons.io.FileUtils.cleanDirectory(FileUtils.java:1044)
    at org.apache.commons.io.FileUtils.deleteDirectory(FileUtils.java:977)
    at com.badlogicgames.packr.Packr.pack(Packr.java:56)
    at com.badlogicgames.packr.Packr.main(Packr.java:274)

and the working tree was deleted.

It would be good if deleting an existing directory triggered a confirmation.

App won't open on OS X Mavericks

I packed a simple "hello world" application for OS X and it runs on my development machine fine. However, on a machine with a fresh install of Mavericks, where there is no JVM, the app does not run, instead I get a dialog prompting me to install Java 6:

mavericks

Packr command was as follows:

java -jar packr-1.1-SNAPSHOT-jar-with-dependencies.jar
  -platform mac
  -jdk "openjdk-1.7.0-u45-unofficial-icedtea-2.4.3-macosx-x86_64-image.zip"
  -executable hello 
  -appjar gui.jar
  -mainclass "com/example/gui/HelloWorld"
  -minimizejre true
  -outdir out.app

Java version on OS X 10.6.8

I'm looking for a good strategy to solve a problem with customers not able to start the game on OS X 10.6.8.

User issue here:
http://community.playstarbound.com/index.php?threads/crash-at-startup-mac.83079/

With the help of Google looking for "EXC_BREAKPOINT _forwarding_ + 673" I found some hints that OS X 10.6.8 and lower might have issues with anything newer than JRE 1.7.0 u25, a version which I can't even find for download anymore.

Example:
http://forums.poxnora.desertowlgames.com/index.php?threads/mac-troubleshooting.1338/#post-13271

Right now I see a few approaches:

  • Let packr try to detect somehow that it's running on <= 10.6.8, then try to load the system JRE. No idea yet if this works (means I didn't try it yet).
  • Bump the minimum requirements to OS X 10.7, ask users to upgrade if possible. This wouldn't get us much love from customers who already bought it.
  • Leave it as it is for our game, point users to try running the .jar directly. Not very convenient.

Not compatible with Capsule.io jars but with Workaround

Summary: packr appears to extract/recompress the Capsule fat jar in the classPath and it no longer loads. Replacing the generated output jar with the original will return the Capsule functionality and the generated native executable is able to run it.

Tested environment:

  • Windows 10 Enterprise x86_65
  • Java 8u101 x86_64
  • Latest downloaded Packr.jar
  • Latest capsule-maven (from sg.enixsoft)

My current build process has Capsule build a fat jar to include all dependencies including the signed BouncyCastle provider. When I use packr on this jar file, it appears to modify the capsule.jar such that it no longer runs with java -jar name_of_capsule.jar . Here are the steps to recreate with a known good capsule.jar file (in this example ecc-tester-java-0.1-SNAPSHOT-capsule.jar)

java -jar packr.jar --platform windows64 --jdk jre\winx86_64\jdk1.8.0_101.zip --executable ecc_test_packr --mainclass Capsule --classpath jar\ecc-tester-java-0.1-SNAPSHOT-capsule.jar --output output --vmargs Xmx1G --verbose
Cleaning output directory 'D:\work\shoon\temp\installer\output' ...
Copying executable ... 
Copying classpath(s) ...
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.
Removing foreign platform libs ...
  # Unpacking 'jar\ecc-tester-java-0.1-SNAPSHOT-capsule.jar' ...
  # Repacking 'jar\ecc-tester-java-0.1-SNAPSHOT-capsule.jar' ...
  #3076 kb -> 3076 kb
Done!

Changing into the output directly, run the generated exe. Since there is no console log on windows send to log (native.exe > log) and see that it exits immediatly after invoking the Capsule class:

Loading JVM runtime library ...
Passing VM options ...
  # -Xmx1G
Creating Java VM ...
Passing command line arguments ...
Loading JAR file ...
Invoking static Capsule.main() function ...

Attempt to run the output jar file exhibits the same behavior - it simply exits

java -jar ecc-tester-java-0.1-SNAPSHOT-capsule.jar

Now I replaced that jar file with the original/source capsule jar to do a sanity check

 java -jar ecc-tester-java-0.1-SNAPSHOT-capsule.jar
...APPLICATION LOG STARTS HERE

Now that the jar is working again, retest the generated exe (but still no console output, have to send to a log (native.exe > log))

java -jar ecc-tester-java-0.1-SNAPSHOT-capsule.jar
Loading JVM runtime library ...
Passing VM options ...
  # -Xmx1G
Creating Java VM ...
Passing command line arguments ...
Loading JAR file ...
Invoking static Capsule.main() function ...
...APPLICATION LOG STARTS HERE

Final note: The original capsule jar file and the packr output jar file have binary diffs but extracting them (using 7zip) shows no internal differences.

Some ambiguity with vmargs in config.jason

I am having problem with showing splash screen using exe generated with packr. I tried changing config.jason to include vmargs, but no luck.
This is my Folder Structure

G:/packr/out_windows
---jre
---simphy.jar
---jogamp-fat.jar
---commons-net-3.4.jar
---splash.png
---simphy.exe
---config.jason

Application shows splash screen, when I run through command prompt with this command
javaw -Xmx1G -splash:splash.png -classpath simphy.jar;jogamp-fat.jar;commons-net-3.4.jar org.shikhar.simphy.Sandbox

but when application is invoked through packr generated exe, no splashscreen is shown(although application runs properly). This is my config.jason

{
  "classPath": [
    "Simphy.jar",
    "jogamp-fat.jar",
    "commons-net-3.4.jar"
  ],
  "mainClass": "org.shikhar.simphy.Sandbox", 
  "vmArgs": [
    "splash:splash.png",
    "Xmx1G"
    ]
}


The content of simphy.jar(which contains main class) is as shown

simphy.jar
---META-INF
---org
---splash.png

and this is content of META-INF in simphy.jar

Manifest-Version: 1.0
Main-Class: org.shikhar.simphy.Sandbox

Too aggressive minimizejre: Breaks Gdx.app.getPreferences

Problem happens only with minimizejre: true.

Used JRE: openjdk-1.7.0-u40-unofficial-windows-i586-image.zip

Application throws exception

    javax.xml.parsers.FactoryConfigurationError: Provider com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl not found
            at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:127)
            at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:92)
            at java.util.XMLUtils.load(XMLUtils.java:74)
            at java.util.Properties.loadFromXML(Properties.java:868)
            at com.badlogic.gdx.backends.lwjgl.LwjglPreferences.<init>(LwjglPreferences.java:51)
            at com.badlogic.gdx.backends.lwjgl.LwjglPreferences.<init>(LwjglPreferences.java:41)
            at com.badlogic.gdx.backends.lwjgl.LwjglApplication.getPreferences(LwjglApplication.java:307)
            at com.redacted.w.data.DataStorage.<init>(DataStorage.java:35)
            at com.redacted.w.MainApp.create(MainApp.java:132)
            at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136)
            at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114)
    Caused by: java.lang.ClassNotFoundException: com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Class.java:270)
            at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:123)
            at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:178)
            at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:147)
            at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:265)
            at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:121)
            ... 10 more

on accessing preferences by using Gdx.app.getPreferences("name")

Userful comment from @tommyettinger on IRC:

<TEttinger> comment out this line and I think that should enable the dependencies of prefs.  it may need others
<TEttinger> https://github.com/libgdx/packr/blob/master/src/main/java/com/badlogicgames/packr/Packr.java#L189

Exe created by packr flagged as virus

We use packr to generate an .exe for our game. However, this Windows exe gets flagged as malware by a fairly wide range of virus scanners.

Here is the complete report:
https://www.virustotal.com/en/file/528b2fe72c5e478ed5212b2f0b04e98275a7d626fb046076407f8b90be0d857c/analysis/1466068465/

Did anyone else experience this issue? Am I right to suspect it has nothing to do with our actual application (as the exe does not contain any of our actual code)? Not sure how to prevent this.

Implement file associations on OS X

Since OS X has its own, non standard way of managing file associations, it would be nice if the launcher could capture the file open events and turn them into regular command line arguments.

Java VM long argument prevents .exe from start under windows

UTF-8 encoding must be explicitly specified under Windows. I.e. argument "-Dfile.encoding=UTF-8" must be used to start JVM. Otherwise all non ascii strings becomes corrupted in the game. It is true for official JRE 7, as well as for unofficial JRE 7.

So the game is started with corrupting russian letters by the .exe after packing. The game could be successfully started with correct letters by manually executing:

jre\bin\java.exe -jar -Dfile.encoding=UTF-8 desktop.jar

However .exe is not working when one includes "-Dfile.encoding=UTF-8" argument in config. I.e. the .exe just does nothing (now errors, no game start) with the following config:

{
   "jar": "desktop.jar",
   "mainClass": "com/mmxgames/ttj/desktop/Launcher",
   "vmArgs": [
      "-Xmx1G",
      "-Dfile.encoding=UTF-8"
   ]
}

I was experimenting and found this happens if the argument exceeds 14 characters. So it starts with argument "-Dfile.encodin" but does not start with argument ""-Dfile.encoding" (of corse the argument itself does not work).

JavaFX's Application class cannot find the main class, despite being invoked from the former.

The executable shuts off the JVM as soon as Application.launch(args) from JavaFX is ran. Test message was placed directly after the invocation and was not displayed on the console.

    public static void main(String[] args) {
        System.out.print("test0");
        initRuntime();

        String devCheck = System.getenv("tailor-dev-mode");
        if (devCheck != null && devCheck.equalsIgnoreCase("true")) {
            LaunchOptions options = new LaunchOptions(true);

            log.info("Running in development mode!");
            launchGame(options);
            return;
        }

        System.out.println("test1");
        Application.launch(args);
        System.out.println("test2"); // never shown
    }
Loading JVM runtime library ...
Passing VM options ...
  # -Xms512M
  # -Xmx1536M
Creating Java VM ...
Passing command line arguments ...
Loading JAR file ...
Invoking static me.scarlet.undertailor.desktop.DesktopLauncher.main() function ...
test0test1
Destroyed Java VM ...
Press ENTER key to exit.

Built using a 64bit Oracle JRE, unminified for the purpose of testing.

Segfault 11 on startup

I'm trying to create a test application using packr, but when I try to launch the app it crashes out with a segmentation fault 11. I tried it with the bit.ly linked packr.jar and with a freshly built from the git repo.

This is the json file:
{
"platform": "mac",
"jdk": "openjdk-1.7.0-u60-unofficial-macosx-x86_64-image.zip",
"executable": "test-packr",
"appjar": "dist/test-packr.jar",
"mainclass": "test/packr/TestPackr",
"vmargs": [
"-Xmx1G"
],
"outdir": "mac-test-packr.app"
}

This is the crash report:

Process: launchd [958]
Path: /Users/USER/*/mac-test-packr.app/Contents/MacOS/test-packr
Identifier: com.yourcompany.identifier
Version: ??? (???)
Code Type: X86-64 (Native)
Parent Process: launchd [223]

Date/Time: 2014-07-16 10:15:11.561 -0400
OS Version: Mac OS X 10.7.5 (11G63)
Report Version: 9

Interval Since Last Report: 195531 sec
Crashes Since Last Report: 25
Per-App Crashes Since Last Report: 11

Crashed Thread: Unknown

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00007fff5fc01028

Backtrace not available

Unknown thread crashed with X86 Thread State (64-bit):
rax: 0x0000000000000055 rbx: 0x0000000000000000 rcx: 0x0000000000000000 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x0000000000000000 rbp: 0x0000000000000000 rsp: 0x0000000000000000
r8: 0x0000000000000000 r9: 0x0000000000000000 r10: 0x0000000000000000 r11: 0x0000000000000000
r12: 0x0000000000000000 r13: 0x0000000000000000 r14: 0x0000000000000000 r15: 0x0000000000000000
rip: 0x00007fff5fc01028 rfl: 0x0000000000010203 cr2: 0x00007fff5fc01028
Logical CPU: 2

Binary images description not available

External Modification Summary:
Calls made by other processes targeting this process:
task_for_pid: 1
thread_create: 0
thread_set_state: 0
Calls made by this process:
task_for_pid: 0
thread_create: 0
thread_set_state: 0
Calls made by all processes on this machine:
task_for_pid: 5194
thread_create: 1
thread_set_state: 0

Model: MacBookPro10,1, BootROM MBP101.00EE.B02, 4 processors, Intel Core i7, 2.6 GHz, 16 GB, SMC 2.3f36
Graphics: NVIDIA GeForce GT 650M, NVIDIA GeForce GT 650M, PCIe, 1024 MB
Graphics: Intel HD Graphics 4000, Intel HD Graphics 4000, Built-In, 512 MB
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434314753364D465238432D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xEF), Broadcom BCM43xx 1.0 (5.106.198.19.22)
Bluetooth: Version 4.0.8f17, 2 service, 18 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM512E, 500.28 GB
USB Device: hub_device, 0x8087 (Intel Corporation), 0x0024, 0x1a100000 / 2
USB Device: FaceTime HD Camera (Built-in), apple_vendor_id, 0x8510, 0x1a110000 / 3
USB Device: hub_device, 0x8087 (Intel Corporation), 0x0024, 0x1d100000 / 2
USB Device: hub_device, 0x0424 (SMSC), 0x2512, 0x1d180000 / 3
USB Device: Apple Internal Keyboard / Trackpad, apple_vendor_id, 0x0262, 0x1d182000 / 5
USB Device: BRCM20702 Hub, 0x0a5c (Broadcom Corp.), 0x4500, 0x1d181000 / 4
USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8286, 0x1d181300 / 7

Does this work with JRE 8 ?

Sorry, it might be a stupid question, but I see you need to bundle a zip file with JRE which is downloaded from link you provided, but there is only 7 jre, not 8 does this mean that if my app is built using 8 there is not way to create executable using packr?

Fine-tuning for a few string operations

I find that a few string operations can be optimised in the function "launchVM".

  • How do you think about to assign the result of the expression "execDir + std::string("/config.json")" to a variable?
  • Would it be a bit more efficient to append data to the variable "execDir" instead of using the additional "jarFile"?

Can't deploy libGDX game

I use Android studio. When I run the game from the Ide, I works fine.

I used this link to deploy jar file: https://github.com/libgdx/libgdx/wiki/Gradle-on-the-Commandline#packaging-the-project
Used gradlew desktop:dist command. jar deployed succesfully.

When I double click on the jar file, window opens but closes back immediately. But when I open a command window and run java -jar myapp.jar, it works fine.

Then I used Packr tool. Here is a link: https://github.com/libgdx/packr I used this command:
java -jar packr.jar -platform windows32 -jdk "openjdk-1.7.0-u80-unofficial-windows-i586-image.zip" -executable AutumnDark -classpath desktop-1.0.jar -mainclass "com.nightlybuild.digital.autumnlake.one.desktop.DesktopLauncher" -minimizejre "soft" -outdir outwin -vmargs "-Xmx1G" -resources assets
I have my assets in assets folder. Also they were packed into the original jar file.

It works fine, but gives an warning, something like logger not found. Which is not mandotary, I think.

Inside outwin folder, everything looks fine. There are .exe, .jar, config.json, jre folder, and assets folder with all the assets.

When I run the jar from command file like below game works. Still cannot double click on it.

When I run exe by double clickingon it, the game starts. Everything runs normal until (I am just guessing, I used game.exe > o.txt in the command prompt to deduce this from output) game tries to read an asset/file. Then without error, output says this Destroyed Java VM .... I don't have any experience with the Packr tool.

Troubleshooting: I am using win10 tried compatibility mode and administrator mode. Nothing is read only. Tried with -vmargs "-Xmx1G" and without. Tried with -resources assets and without. Game runs perfectly if I run the jar with console.

Thanks in advance.

If any other information is necessary, please ask me.

The OSX app got can't open

I got
"you can't open the application because powerpc applications are no longer supported"
How can I do?

packr with OpenJDK for Java 1.8

Hey! I've been reading about how to deploy my project, but I can't figure out how to bundle it with an jre. I've looked at packr and read the README.md, and it gives this link:
https://github.com/alexkasko/openjdk-unofficial-builds

However, that project is discontinued. I can't figure out how to make my own builds to use for my own proejcts. Can someone point me in the right direction?

Thanks.

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?

linux segfault on startup

Looks similar to #21, but that is for Mac

I'm packing with this shell script:

#!/bin/bash

ZIPFILE="openjdk-1.7.0-u45-unofficial-icedtea-2.4.3-linux-amd64-image.zip"
#ZIPFILE="openjdk-1.6.0.zip"

java -jar packr.jar \
     -platform linux64 \
     -jdk "$ZIPFILE" \
     -executable superior-tactics \
     -appjar desktop.jar \
     -mainclass "org/jrenner/superior/desktop/DesktopStarter" \
     -vmargs "-Xmx1G" \
     -outdir packed


     #-minimizejre "soft" \

and I am using this jar file: desktop.jar

After packing, I can run "(packed directory)/jre/bin/java -jar desktop.jar" and it runs fine. But the native executable spits out a segfault when used.

jrenner@pc:~/packr/packed$ ./superior-tactics 
config file: /home/jrenner/packr/packed/config.json
jar: /home/jrenner/packr/packed/desktop.jar
mainClass: org/jrenner/superior/desktop/DesktopStarter
vmArg 0: -Xmx1G
jre: /home/jrenner/packr/packed/jre/lib/amd64/server/libjvm.so
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5d75745284, pid=7547, tid=140039404279680
#
# JRE version: OpenJDK Runtime Environment (7.0-b31) (build 1.7.0-u45-unofficial-b31)
# Java VM: OpenJDK 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x5fc284]  get_method_id(JNIEnv_*, _jclass*, char const*, char const*, bool, Thread*)+0x84

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException

When trying to run on Mac OS X (El Capitan) it errors out with the exception

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 15
    at com.badlogicgames.packr.Packr.parseArgs(Packr.java:429)
    at com.badlogicgames.packr.Packr.main(Packr.java:314)

The following is what I'm executing to package my application.

java -jar ~/Downloads/packr.jar -platform-mac -jdk "https://bitbucket.org/alexkasko/openjdk-unofficial-builds/downloads/openjdk-1.7.0-u80-unofficial-macosx-x86_64-bundle.zip" -executable foo -classpath ["dist/frankenjar.jar"] -mainclass "JarMain" -vmargs "-Xmx1G" -minimizejre "soft" -outdir ./exe/

Mac OS X: X11 installation is required to start app

The freshly built Mac OS X app starts (Max OS X 10.9.5) lead to:

  • terminal window is opened
  • the message "X11 installation required. Install?" appears on the screen.

Is X11 really required to start java app? Or it is a kind of bug? Just not sure that the users will do it to run a small game.

Embedded JVM not used

Hello,

I started using your application, and I seem to have finally found the way to distribute my Java application on OSx as well, without forcing users to install a whole JVM.
I am currently facing only a (hopefully) last problem, which I am sure you can help me fixing.
The problem happens only on MACOSx.
I embedded the openjdk 1.7_u45_x86-64_OSx in my application, and I am currently able to fully run my application from command line (using a bash script similar to the one suggested in a previous discussion).
Actually, I am stucked because of the following problem:

1 - if I call the script from Info.plist (set as Executable file), the application is not able to start, actually it seems to completely ignore the embedded JVM and it tries to use the JVM 1.6 which was installed on OSx (10.10.5). When doing the same thing on 10.11 El Capitan, I am prompted for installing the JRE

2 - I wanted to try recompiling the native packr for OSx, but when I try to run the build-mac.sh script, the system complains that no Xcode project is found in the specified directory.

So, actually my questions are the following:

1 - can you help me understanding why the script works fine when launched from command line, while it fails when double clicking on the .app?

2 - can you tell me what I should do to recompile the packr_mac with the suggested modification?

Thank you very much,

Lorenzo

Error code [126]:

Hello,

Im getting "Error code [126]:" when running my jar with the windows32 generated .exe (jre1.8.0_92). I have tested it with the windows64 generated .exe, and manually running the jar with the copied JRE (and checked that is a 32 bits JRE) and works fine.

Testing on latest version of windows 10. Any help or hint would be welcome.

IOException with macosx and jar minification

get this trace:

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
Exception in thread "main" org.zeroturnaround.zip.ZipException: java.io.IOException: File out-linux64/myjar.jar.tmp/META-INF/license exists and is not a directory. Unable to create directory.
        at org.zeroturnaround.zip.ZipUtil.rethrow(ZipUtil.java:2556)
        at org.zeroturnaround.zip.ZipUtil.iterate(ZipUtil.java:379)
        at org.zeroturnaround.zip.ZipUtil.unpack(ZipUtil.java:704)
        at org.zeroturnaround.zip.ZipUtil.unpack(ZipUtil.java:689)
        at com.badlogicgames.packr.Packr.minimizeJre(Packr.java:216)
        at com.badlogicgames.packr.Packr.pack(Packr.java:157)
        at com.badlogicgames.packr.Packr.main(Packr.java:345)
Caused by: java.io.IOException: File out-linux64/myjar.jar.tmp/META-INF/license exists and is not a directory. Unable to create directory.
        at org.apache.commons.io.FileUtils.forceMkdir(FileUtils.java:1482)
        at org.zeroturnaround.zip.ZipUtil$Unpacker.process(ZipUtil.java:822)
        at org.zeroturnaround.zip.ZipUtil.iterate(ZipUtil.java:368)
{
    "platform": "linux64",
    "jdk": "/Users/mori/jres/openjdk-1.7.0-u80-unofficial-linux-amd64-installer.zip",
    "executable": "myjar",
    "appjar": "myjar.jar",
    "mainclass": "com.moribellamy.Main",
    "vmargs": [
       "-Xmx1G"
    ],
    "resources": [
    ],
    "minimizejre": "soft",
    "outdir": "out-linux64"
}

Oddly, i dont have this problem when i don't use jar minification on mac. When I run on ubuntu, I can use minification and the whole thing works.

[193] %1 is not a valid Win32 application.

Using a locally-built version of packr at commit 08a74d4, since you guys don't seem to update the main download link. This seems to break SLF4J logging during building.

The program compiles fine, but the executable does nothing other than provide me with the title message.

Loading JVM runtime library ...
Error code [193]: %1 is not a valid Win32 application.
Error: failed to load VM runtime library!

Using OpenJDK 1.8.0_91-3 from https://github.com/ojdkbuild/ojdkbuild as the bundled JRE on a Windows 7 x64 system, although the same occurs when using an official Oracle JRE.

java -jar packr.jar --platform "windows32" --jdk "C:\Users\Xemiru\Desktop\packr\jre\win32-1.8.0_91.zip" --output "build-win32" -- config.json
@PAUSE
{
    "platform": "windows32",
    "executable": "undertailor",
    "classpath": [
        "undertailor.jar"
    ],
    "mainclass": "me.scarlet.undertailor.desktop.DesktopLauncher",
    "vmargs": ["Xms512M", "Xmx1536M"],
    "minimizejre": "oraclejre8",
    "jdk": "jre/win32-1.8.0_91.zip",
    "output": "build-win32",
    "verbose": true
}

Configuration options above.

Cannot code sign for Mac App Store

The packager unfortunately puts all the java files INTO the Mac OS folder. As a result, the game will not properly code sign.

Would it be possible to ask for ability to move everything except the Mac OS executable to the Resources folder? The game will not code sign with config.json and the jre folder inside the Mac OS folder.

conf-mac2.json.txt

App doesn't run with correct "working dir" on Mac OSX

I have this setup in content/Mac OS/:

myjar.jar
jre/
assets/
etc.

When I double click the generated .app it doesn't find the files located in the assets/ folder. However if I execute the native executable in Mac OS/ directly from terminal it works as expected. So it seems the "working dir" is not set correctly when opening the application normally.

Love you Mario!

The file permissions aren't preserved when unzipping and copying the JRE

I tried to use Packr both with a JRE on my local file system and by passing a URL. Just before the decompression, in both cases, all files in jre/bin are executable. Just after the decompression, in {out}/Contents/MacOS/tmp, you can see that those files are no longer executable as ZipUtil.unpack() does nothing to preserve file permissions:
https://github.com/zeroturnaround/zt-zip/blob/master/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L915

Antialiasing on Mac Retina

When creating an application on a retina Mac, some kind of antialiasing is used. The text is blurry in comparison with the jar run natively (java -jar myapp.jar)
bildschirmfoto 2015-04-09 um 10 25 49
bildschirmfoto 2015-04-09 um 10 25 20

Various minimizejre profiles?

Current minimizeJre() function has fixed set of jre/* standalone files and rt.jar (java runtime lib) packages to be removed. Cmd line argument minimizejre=true/false boolean does not give much choice to fine tune different profiles.

Should minimizejre cmdline be string and then later can introduce two or more minimizing profiles?
minimizejre=none | default | high | medium | minimum | lwjglapp | xyzframeworkapp | ...
Use current values true->default and false->none keeping compatibility or drop them.

Problem on mac. NullPointerException

Hello!

I'm trying to create a application on a mac machine. This is my json script:

{
"platform": "mac",
"executable": "ElModConfig",
"appjar": "ElModConfig.jar",
"mainclass": "eu/elmod/elmodconfig/main/MainFrame",
"outdir": "out.mac"
}

I don't want to add a sdk explicitly, the application should use the installed one (works with jar bundler).
The output when calling java -jar packr.jar mac.json is:

Exception in thread "main" java.lang.NullPointerException
at com.badlogicgames.packr.Packr.main(Packr.java:319)

any idea?

Thanks!
Thomas

Add ARM support

For a project I was working on I thought it might be useful to utilize the packr launcher but there isn't an ARM build (or more specifically, a Raspberry Pi build).

I'm not sure the proper way of going about this, but I was able to get an ARM version built by doing the following:

  1. Removing the platforms directive (platforms { "x32", "x64" }) located at the end of the premake4-linux.lua file
  2. Edit the launcher.cpp file and change the jre assignment
    • From: std::string jre = execDir + std::string("/jre/lib/i386/server/libjvm.so");
    • To: std::string jre = execDir + std::string("/jre/lib/arm/client/libjvm.so");

With these changes I was able to compile it natively on the Raspberry Pi. I imagine this isn't the proper way to do this as I'm not using any defines, etc, but it worked so I figure it might be helpful and it would be much appreciated to see ARM support officially added to Packr.

Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.