Application built by jarbundler fails to launch

172 views Asked by At

I am building a Java 9 application for MacOS using Javapackager, via ant.

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.

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 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.

Here is the equivalent (at least in the sense that it produces the same error) javapackager command line:

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. 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. No object (folder or file) with that name exists in the output directory.

I am missing something, but I am unsure of what. Any advice?

Thanks in advance.

1

There are 1 answers

5
Raul Lapeira Herrero On

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.

Maybe you can try to list files and folders in the folder where this command is running and check if this is correct