How to solve the error Exception in thread "UiPathBridgeThread" java.lang.IllegalAccessError: Class UiPathV8/InvocationUtils(unnamed module 0x00000007FFE3CFC0) can not access class sun/awt/SunToolkit(java.desktop)?
Issue Description:
While trying to interact with UI activities and the UiExplorer tool from the UiPath.UIAutomation.Activities package, to the targeted Java Application IBM i Access Client Solutions, the below error occurred:
WARNING: Could not open windows registry node Software\JavaSoft\Prefs\com\ibm\iaccess at root 0xffffffff80000002. Windows RegOpenKey(...) returned error code 2.
Loading UiPathBridgeInterface Dll
UiPathJavaBridge Interface DLL loaded from: C:\Users\m*********ov\.nuget\packages\uipath\19.8.7173.31251-ce\build\UiPath\UiPathJavaBridgeV8_x64.dll
UiPathBridge loaded by agent injection
Java Version: 17.0.8.1
UiPath Access Bridge started
LoadNewBridgeImpl jarpath: C:\Users\m********ov\.nuget\packages\uipath\19.8.7173.31251-ce\build\UiPath\JavaSupport
adding jaccess.jar url: file:/C:/Users/m*********ov/.nuget/packages/uipath/19.8.7173.31251-ce/build/UiPath/JavaSupport/jaccess.jar
UiPathJavaBridge DLL loaded from: C:\Users\m***********ov\.nuget\packages\uipath\19.8.7173.31251-ce\build\UiPath\UiPathJavaBridgeImplV8_x64.dll
UiPathBridgeImpl call start native
Exception in thread "UiPathBridgeThread" java.lang.IllegalAccessError: Class UiPathV8/InvocationUtils(unnamed module 0x00000007FFE3CFC0) can not access class sun/awt/SunToolkit(java.desktop) because module java.desktop does not export package sun/awt to module unnamed module 0x00000007FFE3CFC0
at UiPathV8.InvocationUtils.invokeAndWait(Unknown Source)
at UiPathV8.UiPathBridgeImpl.getElemFromPoint(Unknown Source)
at UiPath.UiPathBridge.run(Native Method)
at java.base/java.lang.Thread.run(Thread.java:857)
Exception in thread "UiPathBridgeThread" java.lang.IllegalAccessError: Class UiPathV8/InvocationUtils(unnamed module 0x00000007FFAC50C8) can not access class sun/awt/SunToolkit(java.desktop) because module java.desktop does not export package sun/awt to module unnamed module 0x00000007FFAC50C8
at UiPathV8.InvocationUtils.invokeAndWait(Unknown Source)
at UiPathV8.UiPathBridgeImpl.getElemFromPoint(Unknown Source)
at UiPath.UiPathBridge.run(Native Method)
at java.base/java.lang.Thread.run(Thread.java:857)
Root Cause: The issue is caused by a very old UiPath.UIAutomation.Activities package in the UiPath Studio project which does not know how to interact with the targeted Java application.
Resolution: It is recommended to upgrade the UiPath.UIAutomation.Activities package to the latest stable version at the moment and retry the UI interaction with the target application.
The below setup helps to interact with the IBM i Access Client Solutions JAVA application
- UiPath Studio 2023.10.6
- UiPath.UIAutomation.Activities.23.10.11
- Java 8 from IBM Semeru Runtime 8.0.402.0 which can be downloaded from https://github.com/ibmruntimes/semeru8-binaries/releases/download/jdk8u402-b06_openj9-0.43.0/ibm-semeru-open-jdk_x86-32_windows_8u402b06_openj9-0.43.0.msi . Make sure that during the installation, the %JAVA_HOME% checkbox is allowed to be installed
- UiPath Java Extension installed from UiPath Studio
If the Default UI Framework does not recognize UI elements in the target application, open the project and try to indicate the elements in the target application using the UI Explorer from the Design panel. Test all the UI Frameworks, observe the one that recognizes the native UI elements from the page, and use that one in the project.
Example: