I found myself painted into a little development corner recently. Our software has a very tiny bit of Java Swing code in it (one JOptionPane with a JPasswordField in it), and we received a couple of crash reports from an incomplete Java Assistive Technology setup. The gist of the crash report:
java.awt.AWTError: Assistive Technology not found: com.sun.java.accessibility.AccessBridge at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:773) at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:872) at javax.swing.UIManager.<clinit>(UIManager.java:357) at javax.swing.text.JTextComponent.updateUI(JTextComponent.java:332) at javax.swing.JPasswordField.updateUI(JPasswordField.java:148) at javax.swing.text.JTextComponent.<init>(JTextComponent.java:306) at javax.swing.JTextField.<init>(JTextField.java:212) at javax.swing.JPasswordField.<init>(JPasswordField.java:121) at javax.swing.JPasswordField.<init>(JPasswordField.java:68)
I am 100% for supporting assistive devices, but in this case the customers reporting the crash don't use any assistive devices! A little sleuthing with those two customers, and we determined that some other software they have been in contact with installed a different JRE and turned on the Assistive Technology settings. We didn't track down the software, but both customers were university students, so we assume it may be some software provided by their schools.
Given that we only have one small Swing component in the software, the customers weren't actually using any assistive devices, and it is not straightforward to disable/uninstall/configure the Java access bridge for a Java install that is unknown to us (because it was installed for different software), we decided to ask the (hopefully) simpler question: can we override the access bridge setting to turn it off just for us?
We tried a few different methods:
Setting up our own
accessibility.properties in our installed JRE folder.
Clearing the property
javax.accessibility.assistive_technologies and setting
javax.accessibility.screen_magnifier_present to false at the start of the program.
* Overriding the properties using command line flags.
The only solution that worked for us was overriding the properties with command line flags when we launch our software. Here are the flags you need:
Hopefully someone finds this information helpful. Again, this is not a solution to get assistive devices and Java Access Bridge working for your software (which is a good thing!) but it might be helpful if one of your users has some old or conflicting JRE setup cruft on their computer triggering this exception in your software, and to get things working again, you just need to turn the access bridge off.