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

NoSuchFileException when using jpackage on Linux to create a deb installer

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      openjdk version "14-jpackage" 2020-03-17
      OpenJDK Runtime Environment (build 14-jpackage+1-35)
      OpenJDK 64-Bit Server VM (build 14-jpackage+1-35, mixed mode, sharing)


      A DESCRIPTION OF THE PROBLEM :
      When following an example online to create an installer using the recent jpackage I get an error and jpackage fails to create an installer. It's quite possible that the example is out-of-date with the current jpackage arguments and what not but I don't see any obvious issues and I can't figure out how to work around the error either. My apologies if this isn't in fact a bug but something is missing from the example, however, if this is a bug then I'd like to bring it to your attention.

      jpackage fails due to what appears to be it looking for an icon file in the wrong location. You can see in the output that it's looking for the icon in a location that's missing a folder. The icon exists on disk but the path is different from where jpackage is looking for it.

      I'm trying to create a deb based installer in Ubuntu 64-bit using the latest OpenJDK 14 Early Access (2020-03-17).

      The jpackage error is as follows:
      java.nio.file.NoSuchFileException: /tmp/test/images/linux-deb.image/socketclientfx_11.0-1_amd64/opt/socketclientfx/bin/SocketClientFX.png

      jpackage is run as follows:
      jpackage --temp-root /tmp/test --package-type deb --output installer --app-image appimage --name SocketClientFX --app-version 11.0

      The file that it's looking for does exist but it's in a different folder (Note the folder SocketClientFX before the bin folder):
      /tmp/test/images/linux-deb.image/socketclientfx_11.0-1_amd64/opt/socketclientfx/SocketClientFX/bin/SocketClientFX.png

      I'm following this example but with minor modifications for building on Linux, which I'll provide instructions for in the Steps to Reproduce section of this bug.
      https://dzone.com/articles/a-brief-example-using-the-early-access-jpackage-ut


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      These are the commands that I'm running in Linux to checkout the example project from github, modify it for Linux, and replicate the issue. I'm just printing the java version and maven version FYI. I'm not guaranteeing that these instructions will work verbatim on any Linux OS.

      git clone https://github.com/jtconnors/SocketClientFX.git
      cd SocketClientFX
      java -version
      mvn -version
      sed -i 's/mac/linux/g' sh/env.sh
      VAR1=$(which java | sed 's/\/bin\/java//g' | sed 's/\//\\\//g') && sed -i 's/JPACKAGE_HOME=.*/JPACKAGE_HOME='"$VAR1"'/g' sh/env.sh
      sed -i 's/create-image//g' sh/create-appimage.sh
      mv sh/create-dmg-installer.sh sh/create-installer.sh
      sed -i 's/create-installer//g' sh/create-installer.sh
      sed -i 's/dmg/deb/g' sh/create-installer.sh
      sed -i 's/--installer-type/--package-type/g' sh/create-installer.sh
      mkdir /tmp/jpackagetest
      sed -i 's/VERBOSE_OPTION/VERBOSE_OPTION --temp-root \/tmp\/jpackagetest/g' sh/create-installer.sh
      mvn package
      sh/link.sh
      sh/create-appimage.sh
      sh/create-installer.sh


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I expect jpackage to produce a .deb file that I can use to install the example application in Linux.
      ACTUAL -
      jpackage fails with an error as it seems to be looking for a file in the wrong folder. The exact output that I get is as follows:

      devin@devin-VirtualBox:~/packagetest$ git clone https://github.com/jtconnors/SocketClientFX.git
      Cloning into 'SocketClientFX'...
      remote: Enumerating objects: 221, done.
      remote: Total 221 (delta 0), reused 0 (delta 0), pack-reused 221
      Receiving objects: 100% (221/221), 131.45 KiB | 0 bytes/s, done.
      Resolving deltas: 100% (121/121), done.
      Checking connectivity... done.
      devin@devin-VirtualBox:~/packagetest$ cd SocketClientFX
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ java -version
      openjdk version "14-jpackage" 2020-03-17
      OpenJDK Runtime Environment (build 14-jpackage+1-35)
      OpenJDK 64-Bit Server VM (build 14-jpackage+1-35, mixed mode, sharing)
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ mvn -version
      Apache Maven 3.6.2 (40f52333136460af0dc0d7232c0dc0bcf0d9e117; 2019-08-27T11:06:16-04:00)
      Maven home: /home/devin/maven/apache-maven-3.6.2
      Java version: 14-jpackage, vendor: Oracle Corporation, runtime: /home/devin/jdk14ea/jdk-14
      Default locale: en_CA, platform encoding: UTF-8
      OS name: "linux", version: "4.4.0-161-generic", arch: "amd64", family: "unix"
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/mac/linux/g' sh/env.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ VAR1=$(which java | sed 's/\/bin\/java//g' | sed 's/\//\\\//g') && sed -i 's/JPACKAGE_HOME=.*/JPACKAGE_HOME='"$VAR1"'/g' sh/env.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/create-image//g' sh/create-appimage.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ mv sh/create-dmg-installer.sh sh/create-installer.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/create-installer//g' sh/create-installer.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/dmg/deb/g' sh/create-installer.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/--installer-type/--package-type/g' sh/create-installer.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ mkdir /tmp/jpackagetest
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sed -i 's/VERBOSE_OPTION/VERBOSE_OPTION --temp-root \/tmp\/jpackagetest/g' sh/create-installer.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ mvn package
      [INFO] Scanning for projects...
      [INFO]
      [INFO] --------------------< com.jtconnors:SocketClientFX >--------------------
      [INFO] Building SocketClientFX 11.0
      [INFO] --------------------------------[ jar ]---------------------------------
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ SocketClientFX ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] Copying 3 resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ SocketClientFX ---
      [INFO] Changes detected - recompiling the module!
      [INFO] Compiling 4 source files to /home/devin/packagetest/SocketClientFX/target/classes
      [INFO]
      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ SocketClientFX ---
      [INFO] Using 'UTF-8' encoding to copy filtered resources.
      [INFO] skip non existing resourceDirectory /home/devin/packagetest/SocketClientFX/src/test/resources
      [INFO]
      [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ SocketClientFX ---
      [INFO] No sources to compile
      [INFO]
      [INFO] --- maven-surefire-plugin:2.16:test (default-test) @ SocketClientFX ---
      [INFO] No tests to run.
      [INFO]
      [INFO] --- maven-jar-plugin:3.1.1:jar (default-jar) @ SocketClientFX ---
      [INFO] Building jar: /home/devin/packagetest/SocketClientFX/target/SocketClientFX-11.0.jar
      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time: 5.064 s
      [INFO] Finished at: 2019-09-10T11:00:11-04:00
      [INFO] ------------------------------------------------------------------------
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sh/link.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sh/create-appimage.sh
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ sh/create-installer.sh
      java.nio.file.NoSuchFileException: /tmp/jpackagetest/images/linux-deb.image/socketclientfx_11.0-1_amd64/opt/socketclientfx/bin/SocketClientFX.png
      devin@devin-VirtualBox:~/packagetest/SocketClientFX$ ls /tmp/jpackagetest/images/linux-deb.image/socketclientfx_11.0-1_amd64/opt/socketclientfx/SocketClientFX/bin/SocketClientFX.png
      /tmp/jpackagetest/images/linux-deb.image/socketclientfx_11.0-1_amd64/opt/socketclientfx/SocketClientFX/bin/SocketClientFX.png


      ---------- BEGIN SOURCE ----------
      See complete instructions in the Steps to Reproduce section. In a nutshell the original source can be found here:
      https://github.com/jtconnors/SocketClientFX.git
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      I don't have a workaround at the moment but I would certainly like one if there is one :-).

            asemenyuk Alexey Semenyuk
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: