JavaPackager icon indicating copy to clipboard operation
JavaPackager copied to clipboard

Linux startup.sh.vlt template error

Open AstroPixelProcessor opened this issue 3 years ago • 5 comments

I'm submitting a…

  • [ X ] bug report

Short description of the issue/suggestion:

With the current startup.sh.vlt template, once you stop the application when started from the Linux commandline, you will see an error:

exit: 0PK: numeric argument required

What is the expected behavior?

application should exit without this Bash script error

What is the current behavior?

Errors with this error

Please tell us about your environment:

  • JavaPackager version: 1.6.7-snapshot from https://github.com/AstroPixelProcessor/JavaPackager
  • OS version: Linux DEB & PRM
  • JDK version: 17.0.1
  • Build tool:
    • [ X ] Maven
    • [ ] Gradle

Solution : alter the end of startup.sh.vlt template from

#if ($info.administratorRequired) pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY GDKBACKEND=x11 $JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@ #else $JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@ #end exit 0

to

#if ($info.administratorRequired) pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY GDKBACKEND=x11 $JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@ #else $JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@ #end STATUS=$? if [ $STATUS -eq 0 ]; then exit 0 else exit 1 fi

AstroPixelProcessor avatar May 29 '22 14:05 AstroPixelProcessor

Hi @AstroPixelProcessor! Thanks for opening this issue and propose a solution ... I have to do some more research about this problem, as it's a bit weird; at least, I can understand what's happening.

JavaPackager creates binaries for Linux concatenating startup.sh + runnable.jar, and then setting execution permissions in the resulting file (the binary).

It seems that the last line in the startup script (exit 0) has no separation from the merged JAR file (\n after exit 0 is being removed before both files are merged) ... are you using a customized startup script template for Linux?

fvarrui avatar May 31 '22 19:05 fvarrui

Hi @AstroPixelProcessor! Sorry, but I'm not able to reproduce your issue.

fvarrui avatar Jun 08 '22 22:06 fvarrui

Hi @AstroPixelProcessor! Can you give me with an example in order to test it?

fvarrui avatar Jul 12 '22 11:07 fvarrui

Hi @AstroPixelProcessor! I was reviewing old issues and came back to this one.

I decided to apply the next change:

#if ($info.administratorRequired)
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY GDKBACKEND=x11 $JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@
#else
$JAVA $JVMDefaultOptions -cp $JVMClassPath ${info.mainClass} $@
#end
exit $?

This way, the exit code returned by java is also returned by the BASH script, instead of always returning a 0.

fvarrui avatar Sep 03 '22 09:09 fvarrui

Hi @fvarrui,

Apologies for the silence from my side. I will get back to you tomorrow about this one ;-)

I have several other suggestions for the packager and will let you know about it as well after reviewing/studying the latest commits of course.

Mabula

AstroPixelProcessor avatar Sep 04 '22 13:09 AstroPixelProcessor

Hi @AstroPixelProcessor! I close this issue due to lack of activity. If this problem persists, please reopen it. Thanks!

fvarrui avatar Jan 25 '23 13:01 fvarrui