Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X

Related tags

Build packr
Overview

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.

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, without 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. 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.

Comments
  • Mac OS X: X11 installation is required to start app

    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.

    opened by titovmaxim 38
  • Packr-generated exe prints nothing, does nothing

    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?

    opened by tommyettinger 32
  • Could not initialize class java.awt.Toolkit

    Could not initialize class java.awt.Toolkit

    When running the following command .\Jumpai.exe --cli --console --verbose I get:

    Changing working directory to C:\Users\Winter\Desktop\Jumpai-0.0.0-Windows ...
    Loading JVM runtime library ...
    Added DLL search directory C:\Users\Winter\Desktop\Jumpai-0.0.0-Windows\jre\bin
    Added DLL search directory C:\Users\Winter\Desktop\Jumpai-0.0.0-Windows\jre\bin\server
    Passing VM options ...
    versionInformation.dwMajorVersion=10, versionInformation.dwMinorVersion=0, versionInformation.dwBuildNumber=19042
    isZgcSupported()=1, hasJsonValue(jsonRoot, "useZgcIfSupportedOs", sajson::TYPE_TRUE)=0
    versionInformation.dwMajorVersion=10, versionInformation.dwMinorVersion=0, versionInformation.dwBuildNumber=19042
    Passing VM options:
    Creating Java VM ...
    Passing command line arguments ...
    Loading JAR file ...
    Adding 1 classpaths ...
      # Jumpai.data
    Invoking static net.jumpai.client.desktop.DesktopLauncher.main() function ...
    Checked for an exception from the main method, exceptionOccurred=1
    Calling java.lang.Thread#dispatchUncaughtException(Throwable) on main thread
    Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
            at java.desktop/java.awt.Component.<clinit>(Component.java:621)
            at net.jumpai.client.desktop.DesktopLauncher.main(DesktopLauncher.java:34)
    Destroyed Java VM ...
    Press ENTER key to exit.
    

    I'm using AdoptOpenJDK 11 LTS with hotspot

    My packr config is the following

    {
        "platform": "windows64",
        "jdk": "out/jdks/win64-jdk",
        "executable": "Jumpai",
        "classpath": [
            "desktop/build/libs/Jumpai.data"
        ],
        "removelibs": [
            "desktop/build/libs/Jumpai.data"
        ],
        "mainclass": "net.jumpai.client.desktop.DesktopLauncher",
        "minimizejre": "none",
        "output": "out/packr/win64"
    }
    

    (I'm not minimizing the JRE).

    This error is only happening on a fresh Windows 10 installation. On my old Windows 7, everything works fine. If I instead launch the game using .\jre\bin\java.exe -jar Jumpai.data, everything works fine. (This is using the JRE that was output by packr).

    Any idea? Does packr gets rid of java.awt despite minimizejre being unspecified? If so, how come it works when using the same JRE and not the .exe?

    bug 
    opened by WinterAlexander 29
  • Can't run Java 8 on Windows 10 x64 without Windows SDK?

    Can't run Java 8 on Windows 10 x64 without Windows SDK?

    I have a near vanilla Windows 10 VM that cannot run any of the executables with Java 8u111. Running with the console shows

    Loading JVM runtime library ...
    Error code [126]: The specified module could not be found.
    Error: failed to load VM runtime library!
    Press ENTER key to exit.
    

    Things I've tried

    • Verified I'm using the windows64 platform with 64-bit JREs
    • Tried both Oracle JRE and OpenJDK
    • Verified jre\bin\server\jvm.dll exists
    • Installed VC 2013 and 2015 x64 Redistributable (reset to previous snapshot between tries)
    • Searched packr documentation for any Windows runtime dependencies
    • Watched Process Monitor although I'm not sure what I should be looking for
    • No minimize and soft minimize

    The only thing that did work is installing the Windows SDK as specified in #49 . However I clearly can't install that on every users machine. What exactly is required to be installed on a vanilla Windows machine to run the executable?

    Config below

    {
        "platform": "windows64",
        "jdk": "/home/leon/jre-extract/java-1.8.0-openjdk-1.8.0.111-1.b15.ojdkbuild.windows.x86_64.zip",
        "executable": "brailleblaster-packr",
        "classpath": [
            "brailleblaster.jar"
        ],
        "mainclass": "org.brailleblaster.Main",
        "output": "out-packr-win"
    }
    
    opened by TheLQ 16
  • Segfault 11 on startup

    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

    opened by petriborg 16
  • Can't start new processes on MacOS with .app

    Can't start new processes on MacOS with .app

    When using ProcessBuilder, one cannot start a new process within a .app packaged by packr. The same code, run from the same embedded JRE directly, actually can start the processes.

    starting the process throws an IOException with error number 2 or 20, error=2, No such file or directory, both seem to be from posix.

    enhancement 
    opened by idontusenumbers 15
  • Mac non executable app / cannot launch

    Mac non executable app / cannot launch

    Hallo,

    I'm using packr to pack a jar for osx but can't get it working. Im using the equivalent config with win/linux which work but the resulting osx program isn't working. I tried with a minimal java program (no dependancies etc) and it still didnt work. When i manually launch the executable in Contents/MacOS/ i get up a terminal which goes until "Invoking static mainPackage.AppMain.main() function..." and then nothing happens, it stops there and i can only force terminate the program. (if I add .app extension to the Contents folder and then launch the MacOS/ executable i get "Error: failed to load configuration: config.json"). Otherwise for win/linux packr performed great and is a really handy and flexible packaging tool.

    Any help is deeply appreciated, thanks

    Macbook air - version 10.10.5

    opened by mtsamis 11
  • jspawnhelper execute permissions

    jspawnhelper execute permissions

    If the jre/lib/jspawnhelper executable doesn't have execute permissions, calling Runtime.exec, Process.start, etc. will fail. This patch sets jspawnhelper to executable after jre extraction.

    opened by karlsabo 10
  • What exactly is packr looking for (Couldn't find JRE in JDK)

    What exactly is packr looking for (Couldn't find JRE in JDK)

    I am trying to package a mac app. I have tried the following

    • The Zulu MacOSX Zip (and as a folder, extracted too)
    • Installed Oracle JDK on a mac, copied it over to a folder (and zipped it up too)

    And every time, I get the same Couldn't find JRE in JDK. Can I not just specify a jre? There isnt much to go on from the readme. Why does this feel so rigid to work with.

    opened by cyberpwnn 9
  • Embedded JVM not used

    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

    opened by lorenberg 9
  • Does this work with JRE 8 ?

    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?

    opened by azakhary 9
  • Mention another alternative to jpackage/packr in the README

    Mention another alternative to jpackage/packr in the README

    Conveyor is a new packaging tool that supports JVM apps and has a variety of features that jpackage/packr lack. See here for details:

    https://conveyor.hydraulic.dev/

    opened by mikehearn 0
  • Packing with Oracle JDK causes error

    Packing with Oracle JDK causes error

    when building with official Oracle JDK archives There is an error

    WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
    java.nio.file.NoSuchFileException: dist/linux64/tmp/jdk-17.0.4/LICENSE
            at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
            at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
            at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
            at java.base/sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:471)
            at java.base/java.nio.file.Files.createSymbolicLink(Files.java:1069)
            at com.badlogicgames.packr.ArchiveUtils.extractTarArchive(ArchiveUtils.java:196)
            at com.badlogicgames.packr.ArchiveUtils.extractArchive(ArchiveUtils.java:127)
            at com.badlogicgames.packr.Packr.copyAndMinimizeJRE(Packr.java:406)
            at com.badlogicgames.packr.Packr.pack(Packr.java:175)
            at com.badlogicgames.packr.Packr.main(Packr.java:75)
    

    It is because Oracle using a symbolic link on LICENSE file and in archive it seems like an empty file, but it is actually linked to legal/java.base/LICENSE. When it is unpacked, it is working good.

    opened by mkikets99 2
  • macOS on M1

    macOS on M1

    Tested on: macOS Monterey Version 12.4 Chip Apple M1

    Observations: It does not compile with "org.gradle.caching=true" in "gradle.properties"

    opened by santoszv 1
  • How to make generated app to use current working dir as its working dir instead of app's dir?

    How to make generated app to use current working dir as its working dir instead of app's dir?

    I generated an app called mysigner at $HOME/bin/signer/mysigner using packr. It is fast when I launched it. mysigner takes file/folders as parameters. When I launch mysigner from $HOME/work dir, all the relative file paths are getting resolved to $HOME/bin/signer dir. That doesn't make sense.

    What is the trick to make it respect the current working dir and not change to mysigner app location?

    Thanks

    opened by videoguy 0
  • Can you create Linux binary that makes use of installed Java on Linux instead of packaging one with packr?

    Can you create Linux binary that makes use of installed Java on Linux instead of packaging one with packr?

    I like to keep the size of the executable as small as possible. Can I create the binary that makes use of installed JRE or JDK in Linux instead of expecting one when building the binary?

    Thanks

    opened by videoguy 0
Releases(4.0.0)
Owner
libgdx
libgdx
A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

Buck Buck is a build tool. To see what Buck can do for you, check out the documentation at http://buck.build/. Installation Since Buck is used to buil

Facebook 8.5k Dec 31, 2022
a fast, scalable, multi-language and extensible build system

Bazel {Fast, Correct} - Choose two Build and test software of any size, quickly and reliably. Speed up your builds and tests: Bazel rebuilds only what

Bazel 20k Jan 4, 2023
Documentation and issues of https://jitpack.io

JitPack.io JitPack is a novel package repository for JVM and Android projects. It builds Git projects on demand and provides you with ready-to-use art

JitPack 2.3k Dec 27, 2022
XManager-Spotify - An android application where you can manage and install all versions of the spotify app.

For contributors, pull request should be done on the "Developer" branch. The "main" branch is for the release. IMPORTANT NOTES (READ ME FIRST) •xManag

xManager (Spotify) 3.7k Jan 3, 2023
Packages your JAR, assets and a JVM for distribution on Windows, Linux and Mac OS X

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 nativ

libgdx 2.4k Jan 5, 2023
:package: Gradle/Maven plugin to package Java applications as native Windows, Mac OS X, or GNU/Linux executables and create installers for them.

JavaPackager JavaPackager is a hybrid plugin for Maven and Gradle which provides an easy way to package Java applications in native Windows, Mac OS X

Francisco Vargas Ruiz 665 Jan 8, 2023
Download compiled jar from packages or compile it by yourself from sources

idle_codes Install Download compiled jar from packages or compile it by yourself from sources Put the jar file wherever you want. Make sure you have J

null 8 Dec 31, 2021
Terminal GUI library for simple ANSI console tools and graphical interfaces with Windows/Linux support

TerminalCore Terminal GUI library for Windows/Linux. This library contains all colors as ascii codes, native functions of the respective operating sys

Pascal 3 Oct 19, 2022
Pandora - allowing to control different agents (Windows & Linux machine) from server(s) and master

Pandora Pandora is now an open-source project allowing to control different agents (Windows & Linux machine) from server(s) and master. Features Auto-

nz 75 Dec 22, 2022
WavesFX an open-source Waves wallet for Windows, macOS and Linux

WavesFX WavesFX is an open-source Waves wallet for Windows, macOS and Linux. Telegram Chat Releases can be found on the release list. How to build Wav

WavesFX 22 Apr 15, 2022
Small app to create icon sets for Linux, Windows, OSX, Android and IOS from a single PNG image

FXIconcreator Small app to create icon sets (multi resolution) for Linux, Windows, OSX from a single PNG image Reason for creating such an app was tha

null 18 Aug 4, 2022
A prayer times (Adhan) app for Windows and GNU/Linux written in JavaFX.

Salawat Salawat - سالوات A prayer times and Adhan application for Windows, macOS and GNU/Linux written in Java Download » View Demo · Report Bug · Req

DarkBlackChocolate 8 Nov 17, 2022
InstallRepos - Install GitHub Repository on any Operating System (Linux, MacOS or Windows).

Install Repos Install GitHub Repository on any Operating System (Linux, MacOS or Windows). Requires Java JRE 17.0.0.1 or later. Repository Includes: s

Tushar Chaurasia 2 Apr 21, 2022
A virtual Linux shell environment application for Android OS. Runs Alpine Linux in QEMU system emulator. Termux app fork.

vShell (Virtual Shell) — a successor of Termux project which provides an alternate implementation of the Linux terminal emulator for Android OS.

null 2 Feb 1, 2022
A manager tool to categorize game assets such as images and sounds/music. The tool enables you to tag these files, so that finding them by tags allows fast searches.

BtAssetManager This application allows you to easily categorize large amounts of image and sound files. You can apply tags to each individual file to

null 21 Sep 15, 2022
Allows acquiring of vanilla/mod assets at runtime instead of including them in builds potentially violating licenses

AssetMover Allows acquiring of vanilla/mod assets at runtime instead of including them in builds potentially violating licenses. Features: Downloading

Cleanroom 5 Nov 26, 2022
psionic: packages apps realmeParts

RealmeParts RealmeParts is an open-source Android application written in java. It offers several customization settings while making use of various de

psionicprjkt 5 Feb 21, 2022
A mobile provider is a program that has a fixed offer of phones as well as packages, where we can submit requests for the same.

A mobile provider is a program that has a fixed offer of phones as well as packages, where we can submit requests for the same.

Ljubinko Stojanović 4 Apr 27, 2022
Bouncy Castle Java Distribution (Mirror)

The Bouncy Castle Crypto Package For Java The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was developed by t

Legion of the Bouncy Castle Inc 1.8k Dec 30, 2022