launchservicesd:加载java时,secTaskLoadEntitlements失败error = 22 [英] launchservicesd: secTaskLoadEntitlements failed error=22 while loading java

查看:80
本文介绍了launchservicesd:加载java时,secTaskLoadEntitlements失败error = 22的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试运行一个使用.当我运行python脚本时,我在日志中收到此错误/消息.

  launchservicesd:SecTaskLoadEntitlements失败错误= 22appleeventsd:SecTaskLoadEntitlements失败错误= 22 

谁能说出此错误的含义(或坞站中hang/java图标的原因)?我想调试此挂起的原因,但是欢迎调试此错误.

解决方案

您对停靠图标的问题有两个答案,一个是关于为什么它出现的原因,另一个是关于它为什么仍然存在的问题:

  1. 除非使用 -Djava.awt.headless = true 启动JVM,否则当运行的程序首次访问类或JVM时,JVM将初始化GUI子系统(AWT或Swing).方法.使用JRE中的 jjs 程序,可以轻松地看到这一点:

    此命令将运行,但不会会导致停靠图标:

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

    此命令将运行,但引起停靠图标:

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

    通过 -Xdock:icon 如此处所述,如果您只想显示更好的图标

  2. 运行上面的第二个片段,其中包含 JFrame 的片段,揭示了停靠图标为何保留的第二部分:由于 AWT-EventQueue-0线程,该线程负责将GUI事件调度到程序中的所有已注册事件处理程序,程序结束时JVM不会 exit 退出,因为只有主线程退出了,GUI的.

    JVM不知道您已完成与它的交互,因此将永远等待,直到您关闭GUI子系统或停止JVM

为解决您的挂起"问题,通过 System.exit(0)强制关闭JVM可能会很好地满足您的需求.我认为 jnius 语法类似于:

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

但是该语法只是我的推测,因为我的系统上没有安装 jnius .

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 = "/Users/*/sikuli-api-1.0.3-standalone.jar"
os.environ['CLASSPATH'] = jarpath
from jnius import autoclass
DesktopMouse = autoclass('org.sikuli.api.robot.desktop.DesktopMouse')
aa = DesktopMouse()
gg = aa.getLocation()

This code runs without any problem when I run in windows. But when I run this in mac, the program hangs with a java icon in the dock. . and I get this error/message in the logs when I run the python script.

launchservicesd: SecTaskLoadEntitlements failed error=22
appleeventsd: SecTaskLoadEntitlements failed error=22

Can anyone say what this error means ( or the reason for the hang/java icon in the dock )? I would like to debug the reason for this hang but any help in debugging this error would be welcome.

解决方案

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.

这篇关于launchservicesd:加载java时,secTaskLoadEntitlements失败error = 22的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆