gpt4 book ai didi

java - 线程 "main"java.awt.AWTError : Assistive Technology not found 中的异常

转载 作者:行者123 更新时间:2023-11-30 06:25:44 25 4
gpt4 key购买 nike

如何解决这个错误?

Exception in thread "main" java.awt.AWTError: Assistive Technology not found: com.sun.java.accessibility.AccessBridge    at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:775)    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:861)    at java.awt.Window.getToolkit(Window.java:1127)    at java.awt.Window.init(Window.java:369)    at java.awt.Window.(Window.java:407)    at java.awt.Frame.(Frame.java:402)    at java.awt.Frame.(Frame.java:367)    at javax.swing.JFrame.(JFrame.java:163)    at FirstJavaProject.(FirstJavaProject.java:7)    at FirstJavaProject.main(FirstJavaProject.java:5)

It occurs during the execution of following program:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class TenButtons extends JFrame{

JButton [] btns= new JButton[10];

public static void main(String args[]){
new TenButtons();
}
public TenButtons(){
this.setSize(500,500);
this.setTitle("10 Buttons");
this.setLayout(new GridLayout(5,2));
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
for(int i=0; i<btns.length; i++){
btns[i]=new JButton("Button ");
this.add(btns[i]);
}
this.setVisible(true);
}
}

我的 JDK_HOME/jre/lib/accessibility.properties 文件具有以下内容:

## Load the Java Access Bridge class into the JVM ##
assistive_technologies=com.sun.java.accessibility.AccessBridge
#screen_magnifier_present=true

最佳答案

供将来引用,此异常的更常见原因之一是 Java Access Bridge 安装丢失或损坏.在这种情况下,以下访问桥已在标准配置文件 (JDK_HOME/jre/lib/accessibility.properties) 中定义:

com.sun.java.accessibility.AccessBridge

但除非所需的安装完成,否则它实际上不会运行。请注意,标准访问网桥实现随 SDK 一起打包。要解决您的特定问题,请按照其 setup page 中的说明下载并安装 Oracle Access Bridge。 .这应该可以解决程序中发生的启动错误。

关于java - 线程 "main"java.awt.AWTError : Assistive Technology not found 中的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15260989/

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