- Release Notes
- Getting Started
- Setup and Configuration
- Automation Projects
- Dependencies
- Types of Workflows
- File Comparison
- Automation Best Practices
- Source Control Integration
- Debugging
- The Diagnostic Tool
- Workflow Analyzer
- About Workflow Analyzer
- ST-NMG-001 - Variables Naming Convention
- ST-NMG-002 - Arguments Naming Convention
- ST-NMG-004 - Display Name Duplication
- ST-NMG-005 - Variable Overrides Variable
- ST-NMG-006 - Variable Overrides Argument
- ST-NMG-008 - Variable Length Exceeded
- ST-NMG-009 - Prefix Datatable Variables
- ST-NMG-011 - Prefix Datatable Arguments
- ST-NMG-012 - Argument Default Values
- ST-NMG-016 - Argument Length Exceeded
- ST-DBP-002 - High Arguments Count
- ST-DBP-003 - Empty Catch Block
- ST-DBP-007 - Multiple Flowchart Layers
- ST-DBP-020 - Undefined Output Properties
- ST-DBP-023 - Empty Workflow
- ST-DBP-024 - Persistence Activity Check
- ST-DBP-025 - Variables Serialization Prerequisite
- ST-DBP-026 - Delay Activity Usage
- ST-DBP-027 - Persistence Best Practice
- ST-DBP-028 - Arguments Serialization Prerequisite
- ST-USG-005 - Hardcoded Activity Arguments
- ST-USG-009 - Unused Variables
- ST-USG-010 - Unused Dependencies
- ST-USG-014 - Package Restrictions
- ST-USG-020 - Minimum Log Messages
- ST-USG-024 - Unused Saved for Later
- ST-USG-025 - Saved Value Misuse
- ST-USG-026 - Activity Restrictions
- ST-USG-027 - Required Packages
- ST-USG-028 - Restrict Invoke File Templates
- ST-USG-032 - Required Tags
- ST-USG-034 - Automation Hub URL
- Variables
- Arguments
- Imported Namespaces
- Recording
- UI Elements
- Control Flow
- Selectors
- Object Repository
- Data Scraping
- Image and Text Automation
- Citrix Technologies Automation
- RDP Automation
- Salesforce Automation
- SAP Automation
- VMware Horizon Automation
- Logging
- The ScreenScrapeJavaSupport Tool
- The WebDriver Protocol
- Test Suite - Studio
- Extensions
- Troubleshooting
- About troubleshooting
- Microsoft App-V support and limitations
- Internet Explorer X64 troubleshooting
- Microsoft Office issues
- Identifying UI elements in PDF with Accessibility options
- Repairing Active Accessibility support
- Automating Applications Running Under a Different Windows User
- Validation of large Windows-legacy projects takes longer than expected
Studio User Guide
Extension for Java
The Java Extension is compatible with any version of JRE's, from Java 3 to Java 17.
When trying to indicate or validate selectors in a Java application, the Robot checks if the extension files are loaded in the target application process.
The files may exist there through various mechanisms:
- by having the extension installed in the JRE (for Java 3 to 8) through the extension mechanism.
- by loading them from a custom folder (for Java 3 to 17, with different steps to follow for Java 9+).
If the extension files are not there, an injection mechanism is used to try to start our bridge.
The Java Extension installer embedded in Studio (and also the ScreenScrapeJavaSupport tool) relies on the extension mechanism to have the extension loaded by the JRE, so it can be used for automating Java-based applications running with Java 3 to 8.
Starting with Java 9, the extension mechanism has been deprecated and the installer is not able to add the necessary files to the JRE. These files must be loaded from a custom folder (more info here).
Starting with UIAutomation package version 22.2.0-preview, with the support of the default injection mechanism, it is no longer mandatory to install the Extension for Java for automating Java-based applications.
You should install the Java extension from Studio or the command line only when the injection mechanism does not work, and when Java applications are using Java 3 to 8. For Java applications using Java 9 or greater, follow the steps described in Installing the extension in a custom folder.
Until UiPath.UIAutomation.Activities version 22.2.0-preview, the injection mechanism didn't work in all cases. Loading the extension from a custom folder was the main method used for applications launched with Java 9+.
.jnlp
applications launched with third-party
applications, such as OWS or IcedTea Web.
The injection mechanism is used by default and the Java extension installation should only be used as a backup method.
The UiPath Extension for Java is installed as follows:
From Studio
- Close any running Java applications.
- Open Studio.
- Navigate to Tools > UiPath Extensions.
- Select Java > Install. A confirmation message appears, informing you that the extension has been installed.
From the command line
C:\Program Files\UiPath\Studio\UiPath\SetupExtensions.exe /Java
in a command prompt window with administrator rights.
Studio and UI Explorer also ask to install the UiPath Extension for Java when you try to select a control inside a Java app and when the bridge is not detected. If you choose to install the UiPath Extension for Java when prompted by UI Explorer, the Java Bridge files get deployed only in the JRE directory which launched the target Java application instead of the JDK directory.
To check if the extension is not working properly, open UIExplorer and try to select controls inside a Java app. If the entire window is selected, it means that the extension is not working properly.
You can tell whether or not the extension is properly installed by the generated selectors for Java controls:
- Valid Selector for Java Controls:
<wnd app=”...” /><java role=”...” />
- Invalid Selector for Java Controls:
<wnd app=”...” /><ctrl role=”client” />
cls
attribute (window class name) in UI Explorer. The class name should be similar to SunAwtFrame
or javax.swing
.
Processes can interact with Java applications regardless of their DPI scaling.
The UiPath Extension for Java can also be installed using the ScreenScrapeJavaSupport tool.
To have the UiPath Extension for Java installed in a custom location, perform the following steps:
-
Create a new folder on your machine in which you wish to install the UiPath Extension for Java (such as
C:\UiPathJavaExt
) and copy the following files to it:UiPathBridge.jar
- located in the%UserProfile%\.nuget\packages\uipath\20.xx.xxxx\build\UiPath\JavaSupport
directory.UiPathJavaBridgeV8.dll
andUiPathJavaBridgeV8_x64.dll
located in the%UserProfile%\.nuget\packages\uipath\20.xx.xxxx\build\UiPath
directory. It is not necessary to copy both files, but it can prevent issues which can occur due to version mismatch between the JRE and the UiPathJavaBridge.
-
The Java Extension Setup mechanism used by UiPath to install the extension deploys the
UiPathBridge.jar
andaccessibility.properties
files in the Java installation directory (usuallyC:\Program Files (x86)\Java\jre1.8.0_xx
). To use the UiPath Extension for Java from a custom folder, the dependency for these files must be loosened, as follows:- For the
UiPathBridge.jar
file, you need to specify the folder in which you copied theUiPathBridge.jar
andUiPathJavaBridgev8.dll
(such asC:\UiPathJavaExt
) when you start the Java application which uses the extension. This is done through the-Djava.ext.dirs = C:\UiPathJavaExt
argument. -
For the
accessibility.properties
file, there are two methods:- Add the
assistive_technologies=UiPath.UiPathBridge
parameter to theaccessibility.properties
global configuration file located in the%userprofile%
directory. Please note that this file is different from the one deployed by the UiPath Extension for Java, and its settings have precedence over the ones set by the Java installation. - Use the
-Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge
argument when you run the target Java application.
- Add the
- For the
System properties need to be properly passed to the target Java application. This can be done through several methods:
- Include the
-Djava.ext.dirs=C:\UiPathJavaExt -Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge
system property in the_JAVA_OPTIONS
environment variable. The JRE loads the properties from the environment variable and the UiPath Extension for Java loaded in the target application. - Use the
C:\Program Files (x86)\Java\jre1.8.0_xx\bin\java.exe -Djavax.ext.dirs=C:\UiPathJavaExt -Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge -jar SwingSet2.jar
command inside command prompt. A confirmation message appears that the UiPath Extension for Java is successfully loaded. - Include the
-Djava.ext.dirs=C:\UiPathJavaExt -Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge
system property in theJAVA_TOOL_OPTIONS
environment variable. Please note that this method only works with Java 5 or greater.
Passing the properties to a Java applet is done with one of the following methods:
-
Using the
appletviewer.exe
application.This method requires you to first create the.java.policy
file in the%userprofile%
folder, and should contain the following:grant { permission java.net.URLPermission "url_of_the_Java_applet", "<em>:</em>"; };
grant { permission java.net.URLPermission "url_of_the_Java_applet", "<em>:</em>"; };Once this is done, the target applet needs to be started viaappletviewer.exe
with this command:C:\Program Files (x86)\Java\jre1.8.0_xx\bin\appletviewer.exe -J-Djava.ext.dirs=C:\UiPathJavaExt -J-Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge url_of_the_java_applet
-
Using the Java Control Panel which is delivered with the JRE.
The Java Control Panel allows you to specify the runtime parameters for each registered JRE. As such, you need to specify the
-Djava.ext.dirs=C:\UiPathJavaExt -Djavax.accessibility.assistive_technologies=UiPath.UiPathBridge
parameter for the target applet. This makes the UiPath Extension for Java load every time the Java applet starts.
The table below present the compatibility between the methods used above, Java versions, and different types of Java applications:
Application Type |
_JAVA_OPTIONS |
JAVA_TOOL_OPTIONS |
Command Line Parameters |
Java Control Panel - Runtime Parameters |
---|---|---|---|---|
Java Desktop Application |
Java 3 to Java 8 |
Java 5 to Java 8 |
Java 3 to Java 8 |
Not Supported |
Java Contained Application (
.exe )
|
Java 3 to Java 8 |
Java 5 to Java 8 |
Java 3 to Java 8 (
1 )
|
Not Supported |
Java Applet |
Java 3 to Java 8 |
Java 5 to Java 8 |
Not Supported |
Java 3 to Java 8 |
Java Oracle Forms |
Not Supported |
Not Supported |
Not Supported |
Not Supported |
1
) - Depending on the command line tool you use, additional parameters might need to be passed through the environment variables.
-Djava.ext.dirs
argument can not be used on Java 9 and greater applications.
The main idea behind loading the extension can be split into 3 requirements:
- Add the
UiPathBridge.jar
andUiPathServiceProvider.jar
to the classpath of the application. -
Make
UiPathJavaBridgeV8.dll
andUiPathJavaBridgeV8_x64
visible toUiPathBrdige.jar
. This can be done in various ways:- place the files in the same folder with
UiPathBridge.jar
; - place the files in the folder above
UiPathBridge.jar
; -
add the two files to a folder and reference its path via an environment variable called
UIPATH_JB_PATH
;It is not necessary to reference both files, but it can prevent issues that can occur due to version mismatch between the JRE and the UiPath Java Bridge.
- place the files in the same folder with
- Configure the application to load assistive technology. This is done via the
accessibility.properties
file which is placed inside the JREs.Note: TheUiPathJavaServiceProvider.jar
file is available in the latest UiPath.UIAutomation.Activities packages (newer than 21.2-preview). If you are using a lower version of UIAutomation, the file can be obtained by temporarily upgrading an empty workflow file to 21.2-preview. This causes unpacking a newer version of theUiPath.nuget
package to the user machine (%UserProfile%\.nuget\packages\uipath
). After getting the file, the package can be downgraded to the version used before the upgrade.
Fulfilling the requirements above depends directly on the way the Java application is started. There are 3 common ways of starting the application and loading the extension.
Applications started from .jar
, .bat
, or .ps1
files
.jar
files: java -jar SwingSet2.jar
The following steps need to be performed:
- Create a new folder on your machine in which you wish to install the UiPath Extension for Java (such as
C:\UiPathJavaExt
) and copy the following files to it:UiPathBridge.jar
andUiPathJavaServiceProvider.jar
- located in the%UserProfile%\.nuget\packages\uipath\20.xx.xxxx\build\UiPath\JavaSupport
directory.UiPathJavaBridgeV8.dll
andUiPathJavaBridgeV8_x64.dll
- located in the%UserProfile%\.nuget\packages\uipath\20.xx.xxxx\build\UiPath
directory.
- Add the previously created folder to the classpath of the target Java application. This is done with the
-cp, -classpath
command. For this example, we considerSwingSet2
the target Java application:C:\Program Files (x86)\Java\jre1.9.0_xx \bin\java.exe -cp SwingSet2.jar;C:\UiPathJavaExt\* -Djavax.accessibility.assistive_technologies=UiPathJavaServiceProvider SwingSet2
.bat
or a .ps1
file, then the file must be analyzed with a text editor. The file that starts the application contains a line similar to
the command java -jar SwingSet2.jar
, but also includes many other parameters. The command can be changed to include the files in the classpath and to specify
the assistive technology parameter. Changes inside those files should be done with caution. In some cases, the classpath and
the additional parameters are picked from environment variables, which is a less invasive method.
Applications started from .exe
files
exe
file, you must find an alternative way of loading the files to the classpath and specifying the assistive technology parameter.
- To load the files from the classpath, you can search for environment variables that the executable reads or for configuration files that specify where the dependencies are loaded. There is nothing standard here, and it depends a lot on the level of customization of the executable.
- The assistive technology can be specified in this case in a manner similar to the one that the extension installer does. The
standard
accessibility.properties
file, can be moved to the%UserProfile%
folder and renamed to.accessbility.properties
.
Applications started from .jnlp
files
.jnlp
type applications is done by default due to an upgrade of the existing injection mechanism.
Scaling is fully supported for Java 9+ applications via parameters. Consider adding the following parameters to the Java application you want to automate to enable scaling support:
sun.java2d.uiScale.enabled
- When unused or set to the exact string value of "true", it is considered true and the following scaling configuration is taken into account. When set to any other value, but "true", (such as True, false, False, abc) then it is considered false and no additional scaling adjustments are made.-
sun.java2d.uiScale
- Values can be passed in three forms:- As ratio (0.5, 2.3, 1.5)
- As percentages (100%, 150%)
- As dpi values (96dpi, 120dpi). It is considered if scaling is enabled. It modifies scaling on both axis.
sun.java2d.win.uiScaleX, sun.java2d.win.uiScaleY
Values can be passed as for thesun.java2d.uiScale
parameter. Both of them are necessary to be considered by the Java application. They are more specific than the general configuration of scaling As such, if all 3 parameters are set, only these are taken into account.