Skip to content Skip to sidebar Skip to footer

Launchservicesd: SecTaskLoadEntitlements Failed Error=22 While Loading Java

I am trying to run a python program ( sikuli ) that imports a jar using jnius. This is the gist of the code in sikuli package that loads the jar file in python import os jarpath =

Solution 1:

There are two answers to your question about the dock icon, the first about why it appears and the second about why it remains:

  1. Unless the JVM is launched with -Djava.awt.headless=true, then the JVM will initialize the GUI subsystem (AWT or Swing) when a running program first accesses a class or method in it. One can trivially see this in action using the jjs program in the JRE:

    This command will run but will not cause the dock icon:

    echo 'java.lang.System.out.println("hello")' | $JAVA_HOME/jre/bin/jjs

    This command will run but will cause the dock icon:

    printf 'var f = new javax.swing.JFrame("frame 1")\nf.setVisible(true)\n' | \ $JAVA_HOME/jre/bin/jjs

    You actually do have influence over the icon that appears in the dock, via -Xdock:icon as described here, if you'd just like a nicer icon to appear

  2. Running that second snippet above, the one with JFrame in it, brings to light the second part of why a dock icon remains: due to the AWT-EventQueue-0 thread that is responsible for dispatching GUI events to all the registered event handlers in your program, the JVM does not exit when your program finishes, because only the main thread has exited, and not the GUI ones.

    The JVM does not know you are finished interacting with it, and thus will wait forever until you either shut down the GUI subsystem or stop the JVM

To solve your "hang" problem, forcefully shutting down the JVM via System.exit(0) may work fine for your needs. I would presume the jnius syntax would be something like:

jls = autoclass("java.lang.System")
jls.exit(0)

but that syntax is only my speculation, as I don't have jnius installed on my system.


Post a Comment for "Launchservicesd: SecTaskLoadEntitlements Failed Error=22 While Loading Java"