tofi86 / universalJavaApplicationStub

universalJavaApplicationStub - an alternative Application launcher script for Java based macOS Apps that works with both Apple's and Oracle's PList format and supports the old Apple Java 6 as well as all the latest Oracle/OpenJDK/Adopt/Corretto JRE's/JDK's. Plus it supports drag&drop to the Dock icon 🎉
MIT License
356 stars 168 forks source link

LSOpenURLsWithRole error #3

Closed iclkevin closed 9 years ago

iclkevin commented 10 years ago

Thanks for putting this together and hosting this. I'm substituting the universalJavaApplicationStub into the sample button demo from Oracle's AppBundler demo, and changing the plist executable name accordingly, but I am getting the following error:

LSOpenURLsWithRole() failed with error -10810 for the file

Do you have any idea what this is? Maybe I am doing something wrong?

tofi86 commented 10 years ago

This seems to happen when you manually edit the app package and the executable. Did you also think aboaut setting the +x chmod flag for the executable on the commandline? Why didn't you use the app bundler ANT task?

iclkevin commented 10 years ago

This definitely should have no problem as a drop in replacement for previous stubs. I handed it off to one of my engineers. He stated the following:

" At line 149. Change: JVMDefaultOptions=/usr/libexec/PlistBuddy -c "print :Java:VMOptions" "${InfoPlistFile}" 2> /dev/null | xargs to JVMDefaultOptions=/usr/libexec/PlistBuddy -c "print :Java:VMOptions" "${InfoPlistFile}" 2> /dev/null | tr '\n' ' ' | sed -E 's/Array \{ *(.*) *\}/\1/g' | sed 's/ */ /g' | xargs "

He also made the script work specifically for our project, so we are good. Thank you for hosting this, I finally found this today and it solved all of our problems.

tofi86 commented 10 years ago

Okay, thanks, I'll have a look... Can you probably attach your plist file for further research on my side?

tofi86 commented 10 years ago

And I'm glad the script was helpful for you! :)

iclkevin commented 10 years ago

The project I was encountering the errors for was the ButtonDemo output from the oracle documentation (I did not modify their plist): http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

tofi86 commented 10 years ago

Any chance you can attach your ButtonDemo Plist file nevertheless?

It seems as you need Java 7 to run the Oracle AppBundler and I don't have my development machine with java 7 around for a couple of days as I'm underway... thanks! :)

iclkevin commented 10 years ago

Sure, here is the plist (I can't figure out how to upload it as a file...):

<?xml version="1.0" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>universalJavaApplicationStub</string>
<key>CFBundleIconFile</key>
<string>GenericApp.icns</string>
<key>CFBundleIdentifier</key>
<string>components.ButtonDemo</string>
<key>CFBundleDisplayName</key>
<string>Button Demo</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ButtonDemo</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>JVMMainClassName</key>
<string>components.ButtonDemo</string>
<key>JVMOptions</key>
<array>
</array>
<key>JVMArguments</key>
<array>
</array>
</dict>
</plist>
tofi86 commented 10 years ago

Thanks. However, I can't reproduce this isse. I don't get any errors...

However, if your engineer says I should change line 149 (which refers to an apple-java-style plist) you're most likely not using the above Oracle Plist generated by the Oracle AppBundler. Or my script somehow mixes things up... ;-) the engineers statement also indicates, that you're using JVM-Options, which aren't present in the Plist file you posted above...

Where exactly is your Java lib directory located within your App? Is it in ${APPNAME}.app/Contents/Java or in ${APPNAME}.app/Contents/Resources/Java

you can leave the ticket open as long as I investigate the issue... :smirk:

iclkevin commented 10 years ago

Sorry, but I know little more about this problem. I will let you know if my engineer discovers any more information. Thank you for your help.

Dylan-M commented 9 years ago

I've come to discover this is because java_home is not being passed the version parameter from the plist file as an argument, and so it's still defaulting to Java 6 when you need something higher.

EDIT: By which I was referencing this part of the plist:

      <key>JVMVersion</key>
      <string>1.7+</string>

I highly recommend using the + here as I did, that way if you don't have JDK7, but do have a LATER JDK such as 8 or 9, it'll detect that instead.

tofi86 commented 9 years ago

Alright, v0.8.0 of this project now has support for the JVMVersion Plist key, so go give it a try and add the following to your apple style Plist file:

      <key>JVMVersion</key>
      <string>1.6+</string>
matgessel commented 5 years ago

I got this error because I migrated an older launcher that still had the following config:

vmoptions="-Xdock:name=Time Tracker"

I'm launching on Sierra 10.12.6 with JDK 11.0.1. I removed the offending -X option and the app launches fine.

To troubleshoot this issue, I edited the generated Info.plist directly and deleted chunks of config until the app launched.