java.awt缺失,线程“主”中的异常java.awt.AWTError:未找到辅助技术

How to solve this error?

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[i]=new JButton("Button ");

this.add(btns[i]);

}

this.setVisible(true);

}

}

My accessibility.properties file has the following content:

## Load the Java Access Bridge class into the JVM ##

assistive_technologies=com.sun.java.accessibility.AccessBridge

#screen_magnifier_present=true

解决方案

For future reference, one of the more common causes of this exception is a missing or corrupt installation of a Java Access Bridge. In this case, the following access bridge has been defined in standard configuration file (JDK_HOME/jre/lib/accessibility.properties):

com.sun.java.accessibility.AccessBridge

But it won't actually be operative unless the required installation is complete. Note that the standard access bridge implementation does not come packages with the SDK. To fix your particular issue, download and install the Oracle Access Bridge by following instructions from their setup page. That should resolve the startup error occurring in your program.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值