gpt4 book ai didi

java - 抑制 GUI?

转载 作者:太空狗 更新时间:2023-10-29 11:48:06 31 4
gpt4 key购买 nike

我正在尝试运行专为 Vuze 设计的插件使用Java。为此,我使用这样的命令:

/home/x/jre1.6.0_14/bin/java -Dazureus.config.path=/home/x/plugin_directory -Dfile.encoding=ANSI_X3.4-1968 -classpath /home/x/P/lib/swtgraphics2d.jar:/home/x/P/lib/Azureus2.jar:/home/x/P/lib/swt.jar org.gudy.azureus2.ui.swt.Main

问题在于启动失败并出现错误:

changeLocale: *Default Language* != English (United States). Searching without country..
changeLocale: Searching for language English in *any* country..
changeLocale: no message properties for Locale 'English (United States)' (en_US), using 'English (default)'
Invoking main failed
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.aelitis.azureus.launcher.MainExecutor$1.run(MainExecutor.java:37)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(SWT.java:3910)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:863)
at org.eclipse.swt.widgets.Display.create(Display.java:851)
at org.eclipse.swt.graphics.Device.<init>(Device.java:152)
at org.eclipse.swt.widgets.Display.<init>(Display.java:479)
at org.eclipse.swt.widgets.Display.<init>(Display.java:470)
at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.<init>(SWTThread.java:84)
at org.gudy.azureus2.ui.swt.mainwindow.SWTThread.createInstance(SWTThread.java:59)
at org.gudy.azureus2.ui.swt.mainwindow.Initializer.<init>(Initializer.java:110)
at org.gudy.azureus2.ui.swt.Main.<init>(Main.java:88)
at org.gudy.azureus2.ui.swt.Main.main(Main.java:255)
... 6 more
Exception in thread "MainRunner" java.lang.SecurityException: VM exit operation prohibited
at org.gudy.azureus2.core3.security.impl.SESecurityManagerImpl$2.checkExit(SESecurityManagerImpl.java:274)
at java.lang.Runtime.exit(Unknown Source)
at java.lang.System.exit(Unknown Source)
at com.aelitis.azureus.launcher.MainExecutor$1.run(MainExecutor.java:42)
at java.lang.Thread.run(Unknown Source)

我确信这是在发生,因为我正在终端上运行该程序。有没有办法抑制 GUI 或让程序认为 GUI 已成功生成?有什么建议吗?

最佳答案

运行前尝试在终端中设置 DISPLAY 环境变量:

export DISPLAY=<IP address>:0.0

您的主机地址(或其主机名)在哪里。

如果您根本不在 GUI 下运行,则必须运行虚拟帧缓冲区。 Xvfb 是我过去用过的那个。只需确保它已安装:sudo apt-get xvfb 然后在运行您的应用程序之前执行以下命令:

Xvfb :1 -ac -screen 0 1024x768x8 &

export DISPLAY=:1

然后运行应用程序..

关于java - 抑制 GUI?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2643179/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com