Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

Relic Solution: What is a Java Agent?


New Relic did not create, nor is it the only, or even first to use -javaagent. A javaagent is a Java Programming Language Feature that was introduced in Java 5.

New features were introduced to the javaagent in Java 6 that are utilized by the New Relic Java Agent starting in version 3+. This is why you must use New Relic Java Agent version 2.x for any application running Java 5 (or the JRockit JVM).

In order to support Java 10, support for Java 6 was deprecated in Agent v4.4.0. Making Agent v4.3.0 the last version compatabile with Java 6.

Java programs start with the main() function. A javaagent is given special permission by the JVM to run a premain() function that executes before the main().
It is in this premain() function that New Relic developers work and from there designate how supported framework are instrumented.

This is how the NR Java Agent is able to work on so many “non-supported” frameworks. The most important thing in installing the New Relic Java Agent is simply passing the -javaagent flag into the JVM. The method for doing this is dependent on the framework/app server. All of our installation instructions are simply ways to pass the -javaagent:/path/to/newrelic.jar into your JVM’s arguments. In the vast majority of cases, this can be done where the Heap options are set.

As the ways that Java Options can be passes into the JVM are literally infinite, if you need additional assistance in appropriately passing the flag in your environment, the developer of that environment would be the best resource.

You can verify that the -javaagent flag is passed into the JVM by performing step 3 in the doc here:

Using the New Relic Java Agent in an environment that we don’t have listed? Tell us how you got it running below!

updated: March 10, 2020

Setup java agent on WebSphere MQ
New Relic Agent and IBM WebSphere Message Broker
Start/Stop agent using Java API
New Relic APM for Java in Azure Web App
How to setup APM for AIX hosted application
Java agent Not seeing data in newrelic dashboard
Impossible to install New Relix agent on tomcat
Unable to make it work with tomcat
Relic Solution: "Supported" Technologies and Instrumentation
Getting issue newrelic.jar installation in mule server
How to enable Newrelic APM monitoring for IBM MQ?
Setup java agent on WebSphere MQ
Declaring agent in build.sbt file in Scala Play project makes the agent shutdown
NewRelic on Ubuntu running Tomcat7
Agent Configuration
New Relic & Websphere MQ (7.5 and above)
New Relic not supporting for Grails version 3.x?
Facing some issue in APM
Java New Relic Agent eating up lot of Memory and CPU along with rest apis resulting in 404