You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ms.custom: sap:Desktop flows\UI or browser automation
7
7
---
8
8
# Can't access the elements of a Java application
9
9
10
-
If you encounter issues while [automating Java applications](/power-automate/desktop-flows/how-to/java)with Power Automate for desktop, follow the steps in this article to troubleshoot the issue.
10
+
When [you automate Java applications](/power-automate/desktop-flows/how-to/java)by using Power Automate for desktop, you experience an issue in which Power Automate can't access the UI elements of the Java application. This article helps you troubleshoot this issue.
Power Automate for desktop can't access the UI elements of a Java desktop application when you use either the [Recorder](/power-automate/desktop-flows/recording-flow) or the [Add UI element](/power-automate/desktop-flows/ui-elements) action in the flow designer.
18
18
19
-
## Troubleshooting steps
19
+
## Diagnose using the troubleshooter
20
20
21
-
To solve this issue, try the [troubleshooter](/power-automate/desktop-flows/troubleshooter) first.
21
+
To resolve this problem, first try the [troubleshooter](/power-automate/desktop-flows/troubleshooter):
22
22
23
-
1. In Power Automate for desktop, navigate to **Help** > **Troubleshooter**, and then run the [troubleshooter](/power-automate/desktop-flows/troubleshooter).
23
+
1. In Power Automate for desktop, go to **Help** > **Troubleshooter**, and then run the [troubleshooter](/power-automate/desktop-flows/troubleshooter).
24
24
25
-
2. In the **Troubleshooter** window, select **Run** on the **Troubleshot UI/Web automation issues** panel.
25
+
1. In the **Troubleshooter** window, select **Run** on the **Troubleshot UI/Web automation issues** panel.
26
26
27
-
3. If an issue is found for **Java Automation**, expand the panel to see the details.
27
+
1. If the troubleshooter finds an issue for **Java Automation**, expand the panel to see the details.
28
28
29
-
4. If a **Fix** button is available, select it to apply the fix. Ensure all running **Java** applications are closed before applying the fix.
29
+
1. If a **Fix** button is available, select it to apply the fix. Make sure that you close all running **Java** applications before you apply the fix.
30
30
31
-
If the issue persists after using the troubleshooter, follow these steps to manually troubleshoot the issue:
31
+
If the problem persists after you use the troubleshooter, follow the steps in [Manual troubleshooting](#manual-troubleshooting)to further troubleshoot the issue.
32
32
33
-
1. Ensure that you have Java installed on your machine:
33
+
## Manual troubleshooting
34
34
35
-
- Open the Command Line tool (cmd) and run the following command:
35
+
> [!NOTE]
36
+
> Use these steps only if the troubleshooter finds no Java installations or can't configure the environment.
36
37
37
-
```cmd
38
-
java –version
39
-
```
38
+
### Configure Java (for Java 8 and 7)
40
39
41
-
- If Java isn't installed, you receive an error message:
40
+
Use these steps to troubleshoot Java 8 and 7. If you're using Java 9 or a later version, see [Configure Java (for Java 9 and later)](#configure-java-for-java-9-and-later).
42
41
43
-
> 'java' is not recognized as an internal or external command, operable program or batch file.
42
+
#### Locate the Java installation folder
44
43
45
-
2. Ensure that the **Enable Java Access Bridge** option is disabled in the Control Panel.
44
+
1. Check common paths such as `C:\Program Files\Java\jre7` or `C:\Program Files\Java\jre8`.
45
+
1. Some apps use an embedded Java runtime that isn't registered system-wide. To identify the location of an embedded Java runtime:
46
46
47
-
Go to **Control Panel** > **Ease of Access** > **Optimize visual display** > **Java Access Bridge from Oracle, Inc. Providing Assistive Technology access to Java applications**, and then disable the **Enable Java Access Bridge** option.
47
+
1. Start the Java application.
48
48
49
-
:::image type="content" source="media/cannot-access-java-application-elements/enable-java-access-bridge-option.png" alt-text="Screenshot of the Enable Java Access Bridge option in the Windows Control Panel." lightbox="media/cannot-access-java-application-elements/enable-java-access-bridge-option.png":::
49
+
1. Open Task Manager.
50
50
51
-
3. Ensure that specific files exist in one or more Java folders of the machine after the Power Automate for desktop installation.
51
+
1. Locate and right-click the `java.exe` process, and then select **Open file location**.
52
+
53
+
1. Use the selected folder as `<JRE_HOME>\bin`.
54
+
55
+
To avoid this issue in the future, install Java under `Program Files` or enable the option to register Java in the system registry during installation.
52
56
53
-
To check the installed Java version and installation path on your machine:
57
+
#### Copy required files (administrator rights required)
54
58
55
-
1. Type _Configure Java_ in the Windows search bar.
56
-
1. Open Java Control Panel and go to the **Java** tab.
57
-
1. Select **View**.
59
+
Copy the following files from the Power Automate for desktop installation folder (`C:\Program Files (x86)\Power Automate Desktop\dotnet\java-support`):
58
60
59
-
:::image type="content" source="media/cannot-access-java-application-elements/java-control-panel.png" alt-text="Screenshot of the Java Control Panel.":::
61
+
-`PAD.JavaBridge.jar` to `<JRE_HOME>\lib\ext\`
62
+
-`Microsoft.Flow.RPA.Desktop.UIAutomation.Java.Bridge.Native.dll` to `<JRE_HOME>\bin\` (x86 or x64 depending on the Java architecture)
60
63
61
-
1. Check the values in the **Path** column. The **Architecture** row with value x86 refers to 32-bit Java installation, while the row with value x64 refers to 64-bit Java installation.
64
+
#### Update accessibility configuration
62
65
63
-
:::image type="content" source="media/cannot-access-java-application-elements/java-runtime-environments-settings.png" alt-text="Screnshot of the Java Runtime Environment Settings.":::
66
+
1. Open `<JRE_HOME>\lib\accessibility.properties` in a text editor. If the file doesn't exist, create it.
If the line starts with the number sign (`#`), remove the `#` character to uncomment it. If other assistive technologies are listed, append the Microsoft value at the end, separated by a comma.
68
72
69
-
- File _Microsoft.Flow.RPA.Desktop.UIAutomation.Java.Bridge.Native.dll_ is replaced in folder _C:\Program Files\Java\jre1.8.0_271\bin_. (replace _jre1.8.0_271_ with your machine's Java installation folder.)
70
-
- File _accessibility.properties_ is replaced in folder _C:\Program Files\Java\jre1.8.0_271\lib_. (replace _jre1.8.0_271_ with your machine's Java installation folder.)
71
-
- If you open the file with Notepad, you should see the following value:
- File _PAD.JavaBridge.jar_ is inserted in folder _C:\Program Files\Java\jre1.8.0_271\lib\ext_. (replace _jre1.8.0_271_ with your machine's Java installation folder.)
73
+
> [!NOTE]
74
+
> Manual file placement works for only Java 8 and 7. Java 9 and later versions don't support using this method to load assistive technologies.
74
75
75
-
- For 32-bit Java installation:
76
+
### Configure Java (for Java 9 and later)
76
77
77
-
- Check the same files but in folder _C:\Program Files (x86) \Java…_.
78
+
For Java 9 and later versions, you can't modify the Java installation in the same manner. Instead, use one of the following methods.
78
79
79
-
4. Check _.accessibility.properties_ file:
80
+
#### Set environment variable (recommended)
80
81
81
-
- Ensure there isn't an _.accessibility.properties_ file in your _C:\Users\user_ folder. (replace _user_ with your user name.)
82
-
- If the file exists, rename it.
82
+
Set a system or user environment variable that's named `JDK_JAVA_OPTIONS` and has the following value (64-bit example):
83
83
84
-
5. Ensure that _VC_redist.x64.exe_, _VC_redist.x86.exe_, or both are run.
:::image type="content" source="media/cannot-access-java-application-elements/installed-microsoft-visual-c-plus-plus-redistributable-versions.png" alt-text="Screenshot of the installed Microsoft Visual C++ Redistributable versions.":::
86
+
For 32-bit Java, use the `x86` folder instead of the `x64` folder.
87
+
88
+
#### Add JVM arguments to the Java application start command
89
+
90
+
Append the following arguments to the app's Java startup command:
-`-Djava.library.path="<PAD install path>\dotnet\java-support\x64"` (for 32-bit Java, use the `x86` folder instead of the `x64` folder)
94
+
95
+
## Key clarifications and troubleshooting tips
96
+
97
+
- Always try the Power Automate for desktop troubleshooter first. It's the safest and fastest method to configure Java automation.
98
+
- Manual file placement applies only to Java 8 and 7. Use the environment-variable method or JVM-argument method for Java 9 and later.
99
+
- Java versions earlier than 7 aren't supported.
100
+
- The attach mechanism might not work reliably for Java 10 or Java 9.
101
+
- If an application uses an embedded runtime, use Task Manager to find the Java executable path.
102
+
- To be able to insert files into Java installation folders, you must have administrator rights.
103
+
- If you insert the files manually, the files aren't updated automatically when Power Automate for desktop is updated. To use the latest Java automation files, repeat the manual file placement after each Power Automate for desktop update.
104
+
- After you make the changes, close all running Java applications, and then restart the computer.
0 commit comments