I am trying to add a static method call to the java.lang.Object constructor using the java.lang.instrument API. I know I have the basics right because it works if I make the method call System.gc(). I verified this by running -verbosegc with and without the instrumentation. If I change the method call to a static class/method in my own package I get a fatal error:
Exception in thread "main" FATAL ERROR in native method: processing of -javaagent failed
No dump files are created in the working directory so I am finding it hard to figure out what's wrong. Other info:
- I ensure the static method class is loaded in the premain method before transformation
- The static method call does not result in creation of new objects
- The last class loaded is InterruptedIOException although I think that's just a side-effect
Thanks in advance.