Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8187357

JavaPackager repackages existing JAR without consideration of the packaging method

XMLWordPrintable

    • x86
    • os_x

      FULL PRODUCT VERSION :
      java version "1.8.0_65"
      Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X El Capitan (10.11.6)

      A DESCRIPTION OF THE PROBLEM :
      When repackaging an input JAR to create a native OS X application, the existing library JARs within the input JAR are being compressed. This is undesirable, as the libraries must be uncompressed in our specific use case.

      Essentially, the bug is that when repackaging an existing JAR, the JavaPackager does not take care of the zip compression of the library files (STORE or DEFLATE).

      Please also refer to this GitHub issue for more details if clarification is required: https://github.com/FibreFoX/javafx-gradle-plugin/issues/83

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I am providing a link to a MVCE. It is an Intellij project on Java 8.

      Steps to reproduce:

      1. Refresh Gradle dependencies
      2. Run ./gradlew jfxJar
      3. Run cd build/jfx/app
      4. Run `java -jar project-jfx.jar

      https://github.com/FibreFoX/javafx-gradle-plugin/files/1256775/library-compression-mvce.zip

      This comment also has all the above information if the URL is not working: https://github.com/FibreFoX/javafx-gradle-plugin/issues/83#issuecomment-325477598


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No exception when running the output JAR that the JavaPackager has produced.
      ACTUAL -
      java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/fxcharts.jar'. It has been compressed and nested jar files must be stored without compression.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.lang.IllegalStateException: Unable to open nested entry 'BOOT-INF/lib/fxcharts.jar'. It has been compressed and nested jar files must be stored without compression.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      https://github.com/FibreFoX/javafx-gradle-plugin/files/1256775/library-compression-mvce.zip

      This comment also has all the above information if the URL is not working: https://github.com/FibreFoX/javafx-gradle-plugin/issues/83#issuecomment-325477598

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The workaround is to create a native application for OS X using the JavaPackager, and then replace the output JAR that it has produced in the .app directory with the original input JAR (note that the input JAR is already bundled with all dependencies and correct classpath settings).

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: