How to add an APM Insight instance or application that has been deleted earlier?

How to add an APM Insight instance or application that has been deleted earlier?

For Java version 7.0 and above

1) Navigate to the APM Insight Java agent folder
2) Each application/instance will have a separate folder. Remove the folder with the name `<application_name>_<application_port>`
3) Delete the `APM_Java_Instances` folder
4) Restart the application server

For Java version below 7.0

APM Insight agent state is maintained in the `apminsight.info` file (located in the directory where the agent jar resides).
Delete this file and restart the application. This will add the APM instance successfully.