When running the Link Agent on a Windows machine, we recommend the following steps to ensure the most reliable Link Agent configuration.
For an optimal setup experience, we recommend running the Link Agent on a persistent Linux server or VM. For more information on system and network requirements for effectively running the Link Agent, see the article on Link Agent requirements.
Step 1: Install Java
The Link Agent runs on Java and requires Java 11 or newer to be installed on the machine. Download and install the Java 11 JDK for Windows. The .msi installer is usually the easiest option.
Configure Java
It may be necessary to set the JAVA_HOME
environment variable if the installer did not do this. To confirm whether JAVA_HOME
was correctly set as a system environment variable, take the following steps:
- Click on the Windows Start button
- In Search, search for and then select "Edit the system environment variables"
- In System Properties, click on Environment Variables.
Accessing system environment variables
If the JAVA_HOME
variable appears in the System variables section, skip ahead to the Verify Java configuration section. If JAVA_HOME
is absent, follow next steps to add it to system environment variables:
- In the System variables section, click on the New… button.
- Enter
JAVA_HOME
as the variable name. - Click on the Browser Directory… button.
- Navigate to the location where Java was installed. This path is usually under "C:\Program Files\Java".
- Choose the directory starting with "jdk-". For example: "jdk-11.0.2"
- Click on the OK button.
Adding JAVA_HOME to system environment variables
After adding the JAVA_HOME
as a system environment variable, add Java to the system Path
variable:
- Click on the
Path
variable in System variables. - Click on the Edit… button.
- Click on the New button.
- Enter
%JAVA_HOME%\bin
. - Click OK to confirm changes to the `Path` variable.
- Click OK on the Environment Variables and System Properties windows.
Adding Java to the system path variable
Verify Java configuration
To verify that Java is installed correctly, run the following command in a command prompt:
java -version
You should see output similar to the following message:
Note that the specific version of Java may differ depending on what the latest version was when you installed it.
Step 2: Retrieve the API key for your workspace
To start up the Link Agent, you need a mabl API key. If a "Link Agent" API key does not already exist for your workspace, take the following steps to create one in the mabl app:
- Go to the APIs page: Settings > APIs.
- Click on + Create API key.
- For Type of API key, select "Link Agent".
- Give the API key a name.
Only workspace owners can create API keys.
Step 3: Download the Link Agent
Download the Link Agent zip file from the networking page in the mabl app: Settings > Networking.
Step 4: Run the Link Agent
In a command prompt, navigate to the directory where you downloaded the Link Agent - link-agent.zip - and extract the archive using the following command:
powershell.exe -NoP -NonI -Command "Expand-Archive link-agent.zip"
To start up the Link Agent, provide the "Link Agent" API key and a Link Agent name as arguments:
bin\link-agent --api-key fake-api-key --name qa-env-01
If your network requires it, you can configure the Link Agent to use an HTTP forward proxy, including support for basic proxy auth. Link Agents also support Proxy Auto-Configuration (PAC).
Run the Link Agent as a Windows service
After confirming that the Link Agent is working, we recommend creating a Windows service for the Link Agent so that the Link Agent will continue running in the background even if you lock the screen or log out.
Running the Link Agent as a Windows service requires a helper program called NSSM. Download NSSM from here, and extract the 64-bit version of the executable to a location on your path. You can create a separate directory for this executable such as C:\nssm
and add that directory to your path, or you can copy the executable to a directory that is already on your path such as C:\windows
.
To run the Link Agent as a Windows service, take the following steps:
- Save the full Link Agent command, including API key, Link Agent name, and any other parameters to a separate
.bat
script in a well-known location, such asC:\mabl\link-agent-wrapper.bat
. The script should contain the absolute path to the Link Agent, as shown in the following example:C:\mabl\link-agent\link-agent\bin\link-agent -a <your-api-key-here> -n <your-link-agent-name-here>
. - Open the command prompt as an administrator.
- Run the following commands in the command prompt:
Create a service for the Link Agent using NSSM, substituting in the path where you have created your wrapper script, and then start the new service:
# Create a service for the Link Agent using NSSM.
nssm install LinkAgent C:\mabl\link-agent-wrapper.bat
# Start the new service nssm start LinkAgent
You can either configure the LinkAgent Windows service to run on startup or start it manually using the nssm start
command.
Step 5: Validate the Link connection is live
After starting the Link Agent, return to the networking page in the mabl app: Settings > Networking. The Link Agent appears in the Link Agents section with an "Initializing" status when starting up. Within a couple minutes of starting up, the Link Agent should show a "Connected" status.
A Link Agent with a "Connected" status
If you don't see the Link Agent listed with a "Connected" status on the networking page, check out this troubleshooting article for next steps.
Next steps
When the Link Agent is installed and running, configure your tests to run over mabl Link.