Gorakh_sth
Gorakh_sth

Reputation: 171

Exception in thread "main" java.awt.AWTError: Assistive Technology not found

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.length; i++){
           btns[i]=new JButton("Button ");
           this.add(btns[i]);
        }
        this.setVisible(true);
    }
}

My JDK_HOME/jre/lib/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

Upvotes: 11

Views: 38330

Answers (4)

Aelast
Aelast

Reputation: 53

To anyone using jlink to create a minified JRE, you can fix this error by including the module "jdk.accessibility" in your list of required modules.

The files required for Access Bridge include the following:

/jre/bin/windowsaccessbridge-64.dll
/jre/bin/javaaccessbridge.dll
/jre/bin/jaccesswalker.exe
/jre/bin/jaccessinspector.exe 
/jre/lib/modules (jlink will include the accessibility module inside this file with the other modules)

Alternatively, you can disable Access Bridge using the command:

jre\bin\jabswitch.exe -disable

Upvotes: 3

Phume
Phume

Reputation: 77

Use Java 11, it is likely you are using Java 8 and it does not have the Assistive Technology or org.GNOME.Accessibility.AtkWrapper.

Also, do not comment out the assistive technology line from the accessibility properties file, this will not fix your problem rather it will misconfigure your layout and you will be left with an ugly or unusable UI.

Upvotes: 1

Manabu Tokunaga
Manabu Tokunaga

Reputation: 1114

Answer for those who:

  • Are using Windows WSL2
  • And have installed OpenJDK 8
  • Have tried to start the Gremlin Console or likewise Java app

And received the same error of Assistive technology not found AWTError the previous approved answers are correct.

For WSL2 and OpenJDK 8 specifically here is what you need to do:

sudo vim /etc/java-8-openjdk/accessibility.properties

Comment out the configuration line out like below:

#assistive_technologies=org.GNOME.Accessibility.AtkWrapper

There is no need to restart WSL session. Simply re-launch the Java app.

Upvotes: 6

Perception
Perception

Reputation: 80633

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.

Upvotes: 11

Related Questions