简体   繁体   English

jarbundler 构建的应用程序无法启动

[英]Application built by jarbundler fails to launch

I am building a Java 9 application for MacOS using Javapackager, via ant.我正在使用 Javapackager 通过 ant 为 MacOS 构建一个 Java 9 应用程序。

The build process succeeds without complaint, but the resulting application does not launch.构建过程毫无怨言地成功,但生成的应用程序没有启动。 However, when I run the executable within the generated application bundle, it does work.但是,当我在生成的应用程序包中运行可执行文件时,它确实有效。 The problem, therefore, seems to be that launchd cannot find or launch that executable.因此,问题似乎是 launchd 无法找到或启动该可执行文件。

When I open the executable, I see:当我打开可执行文件时,我看到:

The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10810 "kLSUnknownErr: Unexpected internal error" UserInfo={_LSFunction=_LSLaunchWithRunningboard, _LSLine=2732, NSUnderlyingError=0x600003f40630 {Error Domain=RBSRequestErrorDomain Code=5 "Launch failed." UserInfo={NSLocalizedFailureReason=Launch failed., NSUnderlyingError=0x600003f404b0 {Error Domain=NSPOSIXErrorDomain Code=21 "Is a directory" UserInfo={NSLocalizedDescription=Launchd job spawn failed}}}}}

The fx:deploy task looks like this: fx:deploy 任务如下所示:

<fx:deploy width="300" height="250"
           nativeBundles="image"
           outdir="Platforms/Macintosh/dist"
           mainClass="<classname>"
           outfile="<applicationname>">
    <fx:application refId="<appid>"/>
    <fx:resources refid="<resources>"/>
    <fx:info title="<appname>" vendor="<myname>"/>
</fx:deploy>

where the <parameters> are specified, of course.当然,指定<parameters>的地方。

Here is the equivalent (at least in the sense that it produces the same error) javapackager command line:这是等效的(至少在产生相同错误的意义上) javapackager命令行:

javapackager -deploy -native image 
    -outdir Platforms/Macintosh/dist -outfile appname 
    -srcdir Platforms/Java/dist -srcfiles jarfilename 
    -appclass classname 
    -name "appname" -title "appname demo" 
    -nosign

jarfilename and classname are set correctly, that is jarfilename is the name of an existing jar file, and classname is the name of a class within that jar file. jarfilenameclassname设置正确,即jarfilename是现有 jar 文件的名称, classname是该 jar 文件中的 class 的名称。 And again, the executable in the generated application bundle runs with the expected outcome.同样,生成的应用程序包中的可执行文件以预期的结果运行。

appname is the name of the application that I want to create. appname是我要创建的应用程序的名称。 No object (folder or file) with that name exists in the output directory. output 目录中不存在具有该名称的 object(文件夹或文件)。

I am missing something, but I am unsure of what.我错过了一些东西,但我不确定是什么。 Any advice?有什么建议吗?

Thanks in advance.提前致谢。

The error you are having is because you are trying to create a file, in this case it is either appname or jarfilename but that path has been already created as a folder, probably by a previous command.您遇到的错误是因为您正在尝试创建一个文件,在本例中它是 appname 或 jarfilename 但该路径已经创建为文件夹,可能是通过先前的命令创建的。

Maybe you can try to list files and folders in the folder where this command is running and check if this is correct也许您可以尝试列出运行此命令的文件夹中的文件和文件夹,并检查这是否正确

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM