I tried to build a profiler using http://www.ibm.com/developerworks/java/library/j-jip/
One of my java applications when executed in command prompt
java -jar abc.jar
gives required output, but when using a javaagent to profile the same application gives error
java -javaagent:profiler.jar -jar abc.jar
gives the following error
Exception in thread "main" java.lang.VerifyError: Expecting a stackmap frame at
branch target 20 in method
()V at offset 12
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
But there are also some swing applications which is running fine with the above javaagent method.