A
aa
Hello,
I was trying to use
java.lang.instrument.Instrumentation.getObjectSize starting from a
couple of blogs, but I can't run my code correctly. What happens is
that I can't make the java agent load the instrumented class.
What I have done:
*) firstly I read
http://weblogs.java.net/blog/mister__m/archive/2004/02/playing_with_th_1.html
*) not being able to making it work I started thinking that a jarfile
is always needed; infact I found
http://forums.java.sun.com/thread.jspa?messageID=3286598� and
http://blogs.sun.com/roller/page/sundararajan/20050106#tracing_class_loading_1_ 5
*) then I tried to reimplement InstrumentationTest example according to
ClassLoadTracer
Unfortunately I have had no success, even moving from Eclipse to the
jdk directly:
*****************CUT HERE*****************
C:\apps\eclipse\workspace\JDK15\sources>javac -source 1.5 -d
...\classes
InstrumentationTest.java
C:\apps\eclipse\workspace\JDK15\sources>cd ..\classes
C:\apps\eclipse\workspace\JDK15\classes>jar cvfm
InstrumentationTest.jar manifest.mf InstrumentationTest*.class
added manifest
adding: InstrumentationTest$1.class(in = 823) (out= 437)(deflated 46%)
adding: InstrumentationTest.class(in = 1800) (out= 958)(deflated 46%)
C:\apps\eclipse\workspace\JDK15\classes>java -ea
-javaagent:InstrumentationTest.jar -cp . InstrumentationTest
Failed to load Premain-Class manifest attribute from
InstrumentationTest.jar
Error occurred during initialization of VM
agent library failed to init: instrument
C:\apps\eclipse\workspace\JDK15\classes>type manifest.mf
Premain-Class: InstrumentationTest
C:\apps\eclipse\workspace\JDK15\classes>
*****************CUT HERE*****************
I am sure that I am missing something, and it should be simple instead.
Anybody can shed some light?
Thanx
AA
I was trying to use
java.lang.instrument.Instrumentation.getObjectSize starting from a
couple of blogs, but I can't run my code correctly. What happens is
that I can't make the java agent load the instrumented class.
What I have done:
*) firstly I read
http://weblogs.java.net/blog/mister__m/archive/2004/02/playing_with_th_1.html
*) not being able to making it work I started thinking that a jarfile
is always needed; infact I found
http://forums.java.sun.com/thread.jspa?messageID=3286598� and
http://blogs.sun.com/roller/page/sundararajan/20050106#tracing_class_loading_1_ 5
*) then I tried to reimplement InstrumentationTest example according to
ClassLoadTracer
Unfortunately I have had no success, even moving from Eclipse to the
jdk directly:
*****************CUT HERE*****************
C:\apps\eclipse\workspace\JDK15\sources>javac -source 1.5 -d
...\classes
InstrumentationTest.java
C:\apps\eclipse\workspace\JDK15\sources>cd ..\classes
C:\apps\eclipse\workspace\JDK15\classes>jar cvfm
InstrumentationTest.jar manifest.mf InstrumentationTest*.class
added manifest
adding: InstrumentationTest$1.class(in = 823) (out= 437)(deflated 46%)
adding: InstrumentationTest.class(in = 1800) (out= 958)(deflated 46%)
C:\apps\eclipse\workspace\JDK15\classes>java -ea
-javaagent:InstrumentationTest.jar -cp . InstrumentationTest
Failed to load Premain-Class manifest attribute from
InstrumentationTest.jar
Error occurred during initialization of VM
agent library failed to init: instrument
C:\apps\eclipse\workspace\JDK15\classes>type manifest.mf
Premain-Class: InstrumentationTest
C:\apps\eclipse\workspace\JDK15\classes>
*****************CUT HERE*****************
I am sure that I am missing something, and it should be simple instead.
Anybody can shed some light?
Thanx
AA