作为 JPackage 安装的一部分,如何在 linux 中制作本机 linux 应用程序可执行文件

How can I make a native linux app executable in linux as part of JPackage installation

我正在使用 JPackage (Java 14) 为 linux.[=15= 打包一个 Java 应用程序(称为 Jaikoz) ]

java 应用程序有时必须调用名为 fpcalc64 的 c 程序,在安装时它会存储在 app 文件夹中, 但它只有 rw 权限

问题一

有没有办法在安装过程中授予它执行权限?

问题二

即使我手动进入应用程序文件夹并使用 chmod 777 fpcalc64 给予完全执行权限,它仍然没有 运行 我的 Java 程序抱怨它没有有权限,即使我重新启动应用程序,仍然会发生这种情况,这怎么可能?

例如

失败

Jul 4, 2020 11:17:46 AM: WARNING: Unable to retrieve an acoustic id for song 2 file /home/ubuntu/Downloads/RedSharp_-_Walk_in_the_row.mp3 because Cannot run program "/home/ubuntu/code/jthink/jaikoz/JaikozAppImage/jaikoz/lib/app/fpcalc64": error=13, Permission denied

但是如果我 运行 从 linux shell 它有效

ubuntu@ubuntu:~/code/jthink/jaikoz/JaikozAppImage/jaikoz/lib/app$ ls -l fpcalc*
-rwxrwxrwx 1 ubuntu ubuntu 2210876 Jul  4 11:15 fpcalc
-rwxrwxrwx 1 ubuntu ubuntu 2249272 Jul  4 11:15 fpcalc64
ubuntu@ubuntu:~/code/jthink/jaikoz/JaikozAppImage/jaikoz/lib/app$ ./fpcalc64 /home/ubuntu/Downloads/Red*
FILE=/home/ubuntu/Downloads/RedSharp_-_Walk_in_the_row.mp3
DURATION=273
FINGERPRINT=AQADtIsURmsSDc9i44-Iqsemr8a1MIOXKBHCi9CJ0M7R-MH5oNNy_Dp26ag55EmUJ5DjI-zREE-P9wz-odeKCyGbHXriIj8qbiYaPRue4_zx7MHHE1eiw1yE80d1IdmDnDy-LCeub_gVVLkGP8uHmTNhVjkicUeyh0MTHs_RE8-Jurg7XItwHVl-aFmHPGMq_Al-NCGFx0d6adD6I39RnQoaTXmK48JhTqOM58R19LED8yBf9LvQo1GW4viRk4Qm6cUvpHlRi8dn9MngFqRy-EdGlNPxHb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DAKSEaQYEwQRBgSBjEhDDJIEOUEQUgBQqhBxAiACAMECEoYYYQRYYAQABkEEBBECEYEQoYQBBkSBBggiUFAAiIIIUKyIggABACAAAIDAA

问题3

我是否必须将 fpcalc64 存储在 bin 文件夹中而不是 lib/app。如果我这样做,我该怎么做,它是一个预编译的二进制文件?

我找到了解决方案(我之前遇到过的问题)。

因为 Java 9 当您在 linux 上使用 Java 调用外部应用程序时,使用 lib/jspawnhelper 来决定如何 运行 应用程序。因为我提供了 linux 运行time 但 运行time 是建立在 Windows 上的,当它被签入源代码管理时它失去了任何执行权限。因此,当我的应用程序抱怨权限时,它实际上是在抱怨 jspawnhelper 的权限。

我还发现,如果您确实设置了权限,那么在构建包时它们将得到尊重。我没有意识到这一点,因为以前我在 Windows 上构建 linux 安装程序并且必须向 Izpack 安装程序添加额外的命令以使它们可执行。

所以总而言之,解决方案是在 jspawnhelper 和 fpcalc 上设置执行权限并提交到源代码管理,然后 Jpackage 就可以了。