use of getObjectSize

A

aa

Hello,

I was trying to use
java.lang.instrument.Instrumen­tation.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&#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\JDK1­5\sources>javac -source 1.5 -d
...\classes
InstrumentationTest.java

C:\apps\eclipse\workspace\JDK1­5\sources>cd ..\classes

C:\apps\eclipse\workspace\JDK1­5\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\JDK1­5\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\JDK1­5\classes>type manifest.mf
Premain-Class: InstrumentationTest
C:\apps\eclipse\workspace\JDK1­5\classes>
*****************CUT HERE*****************

I am sure that I am missing something, and it should be simple instead.
Anybody can shed some light?
Thanx
AA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top