To take full advantage of New Relic's latest features, enhancements, and important security patches, we recommend you update your Java agent to the latest version. For additional information about specific agent updates, refer to the Java agent release notes.
These update procedures describe how to replace some of the current contents of your agent root directory, which contains the New Relic Java agent (newrelic.jar
), with newly downloaded contents from the New Relic UI.
Update to latest version
To identify which version of the Java agent you're currently using, run java -jar newrelic.jar -v
. Your Java agent version will be printed to your console.
Then, to update to the latest Java agent version:
- Back up the entire Java agent root directory to another location. Rename that directory to
NewRelic_Agent#.#.#
, where#.#.#
is the agent version number. - Download the agent.
- Unzip the new agent download file, then copy
newrelic-api.jar
andnewrelic.jar
into the original Java agent root directory. - Compare your old
newrelic.yml
with the newly downloadednewrelic.yml
from the zip, and update the file if needed. - Restart your Java dispatcher.
If you experience issues after the Java agent update, restore from the backed-up New Relic agent directory.
Update agent config differences
We add new settings to newrelic.yml
as we release new versions of the agent. You can use diff
or another diffing utility to see what's changed, and add the new config settings to your old file. Make sure not to overwrite any customizations you've made to the file, such as your license key, app name, or changes to default settings.
For example, if you diff
the default newrelic.yml
files for Java agent versions 7.7.0 and 7.8.0, the results printed to the console will be:
➜ diff newrelic_7.7.0.yml newrelic_7.8.0.yml98c98< #forwarding:---> forwarding:100,101c100,101< # When true, application logs will be forwarded to New Relic. The default is false.< #enabled: false---> # When true, application logs will be forwarded to New Relic. The default is true.> enabled: true
In this example, these lines were added to the default newrelic.yml
in Java agent version 7.8.0. If you are moving to 7.8.0 or higher, you should add these new lines to your original newrelic.yml
.