Hi Hiran,

Looks like jpackage fails because of missing package name on the command line. I agree that the error message is not helpful. Can you try one of jdk19 EA builds [1] to see if the problem is reproducible?

[1] https://jdk.java.net/19/

- Alexey

On 4/1/2022 5:58 AM, Hiran Chaudhuri wrote:
Hello there.

While I am trying to package my project using jpackage 16.0.1 on Ubuntu
20 LTS I have difficulty in assembling the correct commands.

The documentation covers a lot but not everything. For example, it is
not clear to me when I have to provide an option - especially since I
meanwhile take a two step approach of building the appimage, then
tweaking something (that could have done by JPackage directly) and
finally building the DEB package.

While I believe the documentation is good enough, the error messages
presented by JPackage are not. Here is one example. Hopefully you agree
that the NullPointerException does not at all tell me what is wrong and
what I could improve on.

My feeling is that JPackage should do some better error handling and
come up with improved messages.

Hiran


$ jpackage --app-image build/app-image --verbose --dest build
[10:34:45.915] Warning: app-image dir not generated by jpackage.
[10:34:45.930] Running dpkg
[10:34:45.937] Command:
     dpkg --print-architecture
[10:34:45.937] Output:
     amd64
[10:34:45.939] Returned: 0

[10:34:45.944] Running dpkg
[10:34:45.961] Command:
     dpkg -s coreutils
[10:34:45.962] Output:
     Package: coreutils
     Essential: yes
     Status: install ok installed
     Priority: required
     Section: utils
     Installed-Size: 7196
     Maintainer: Ubuntu Developers <
ubuntu-devel-disc...@lists.ubuntu.com>
     Architecture: amd64
     Multi-Arch: foreign
     Version: 8.30-3ubuntu2
     Pre-Depends: libacl1 (>= 2.2.23), libattr1 (>= 1:2.4.44), libc6 (>=
2.28), libselinux1 (>= 2.1.13)
     Description: GNU core utilities
      This package contains the basic file, shell and text manipulation
      utilities which are expected to exist on every operating system.
      .
      Specifically, this package includes:
      arch base64 basename cat chcon chgrp chmod chown chroot cksum comm
cp
      csplit cut date dd df dir dircolors dirname du echo env expand
expr
      factor false flock fmt fold groups head hostid id install join
link ln
      logname ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc
numfmt
      od paste pathchk pinky pr printenv printf ptx pwd readlink
realpath rm
      rmdir runcon sha*sum seq shred sleep sort split stat stty sum sync
tac
      tail tee test timeout touch tr true truncate tsort tty uname
unexpand
      uniq unlink users vdir wc who whoami yes
     Homepage: http://gnu.org/software/coreutils
     Original-Maintainer: Michael Stone <mst...@debian.org>
[10:34:45.962] Returned: 0

[10:34:45.963] Running dpkg-deb
[10:34:45.965] Warning: app-image dir not generated by jpackage.
[10:34:45.967] Warning: app-image dir not generated by jpackage.
[10:34:45.967] java.lang.NullPointerException: Cannot invoke
"java.lang.CharSequence.length()" because "this.text" is null
         at
java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
         at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
         at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
         at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
         at
jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$static$1(Linu
xDebBundler.java:83)
         at
jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(LinuxPa
ckageBundler.java:72)
         at
jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.j
ava:663)
         at
jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments
.java:538)
         at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:98)
         at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
[10:34:45.969] jdk.jpackage.internal.PackagerException: Bundler DEB
Bundle failed because of java.lang.NullPointerException: Cannot invoke
"java.lang.CharSequence.length()" because "this.text" is null
         at
jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.j
ava:685)
         at
jdk.jpackage/jdk.jpackage.internal.Arguments.processArguments(Arguments
.java:538)
         at jdk.jpackage/jdk.jpackage.main.Main.execute(Main.java:98)
         at jdk.jpackage/jdk.jpackage.main.Main.main(Main.java:52)
Caused by: java.lang.NullPointerException: Cannot invoke
"java.lang.CharSequence.length()" because "this.text" is null
         at
java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
         at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
         at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
         at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
         at
jdk.jpackage/jdk.jpackage.internal.LinuxDebBundler.lambda$static$1(Linu
xDebBundler.java:83)
         at
jdk.jpackage/jdk.jpackage.internal.LinuxPackageBundler.validate(LinuxPa
ckageBundler.java:72)
         at
jdk.jpackage/jdk.jpackage.internal.Arguments.generateBundle(Arguments.j
ava:663)
         ... 3 more

$



Reply via email to