Java Agent Integration

A Java agent is a tool that runs before the application’s main method. It is usually a .jar file loaded in the PreMain-Class method, which can change how classes run. The platform lets you automatically start this agent when the JVM initializes.

Tip: All platform-certified Java stacks run the jelastic-gc-agent.jar Java agent for standard optimization. This agent performs regular Full GC calls to reduce memory usage and return unused RAM to the OS. Since JDK version 12, similar functionality is built into Java, thanks to contributions from the platform.

Check the Memory Agent add-on to learn more about the platform’s automatic optimization of Java stacks or to optimize any custom Java container.

Steps to Add a Custom Java Agent to a Container

Step 1: Log in to the platform dashboard with your credentials. Click the Config button for the application server in your Java environment.

Config

Step 2: In the configuration file manager, upload your Java agent .jar file to any preferred location.

Upload Java Agent

Use the Actions list at the top panel or the context menu when hovering over a directory.

Provide a link to the file or upload it from your local machine.

Upload from local machine

Step 3: Switch to the variables.conf file (the location varies depending on the software stack) to add custom variables and JVM options. Specify the javaagent parameter with the path to your .jar file. For example: javaagent:/opt/tomcat/temp/MyJavaFiles.jar.

Save the changes.

Switch to the variable.conf file

Step 4: Restart the nodes of your application server layer to apply the new settings.

Restart node

That’s it! Your custom Java agent is now running.

Save $100 in the next
5:00 minutes?

Register Here