Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: How to Use Instrumentation API

  1. #1
    Join Date
    Mar 2011
    My Mood
    Thanked 1 Time in 1 Post

    Question How to Use Instrumentation API

    I want to check the memory allocation of my objects. As far as I know that java has a concept of agent which need to be passed to the JVM during startup.
    Well I'm trying to use an API viz. classmexer which need to be passed to jvm as described there.
    I did all those things as told ( so far the notion I have is I need to create a agent so that I can have a instance of instrumentation from JVM).

    before I show what I did here are the some facts about my application.

    Application server using : Resin 4.0.38
    JDK in use : 1.6.10
    using ant for build and deployment.
    Passing jvm argument in servers config file as below:

    Note : able to compile successfully.

    HTML Code:
    <resin xmlns="http://caucho.com/ns/resin"
      <resin:import path="${resin.home}/conf/base.xml"/>
      <cluster id="app-tier">
        <resin:import path="${resin.home}/conf/base-cluster.xml"/>
             - The JVM arguments
            <jvm-arg>-javaagent:classmexer.jar</jvm-arg>------------------------>> is the jar file which is located in application's lib folder

    when I start my server I get following Error on servers console:

    HTML Code:
    Error opening zip file or JAR manifest missing : classmexer.jar
    Error occurred during initialization of VM
    agent library failed to init: instrument

    This classmexer.jar contains a manifest file under manifest folder.

    all I want is a helping hand to start JVM with this agent!!!
    Kiindly tell me where I got it wrong?

    Thanking you in advance.

  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Washington, DC
    My Mood
    Thanked 626 Times in 537 Posts

    Default Re: How to Use Instrumentation API

    I don't know anything about this agent stuff you're talking about, but if you want to analyze the memory usage of your program, I recommend using eclipse's memory analyzer tool: Eclipse Memory Analyzer Open Source Project
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. The Following User Says Thank You to KevinWorkman For This Useful Post:

    arvindbis (September 5th, 2014)

  4. #3
    Join Date
    Mar 2011
    My Mood
    Thanked 1 Time in 1 Post

    Default Re: How to Use Instrumentation API

    Thank for your wonderful suggestion.

    But Question Comes here that we should a article about the instrumentation API available in Java.
    What do you say?

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    So. Maryland, USA
    My Mood
    Thanked 658 Times in 645 Posts

    Default Re: How to Use Instrumentation API

    I would say, "What's the question?"

Similar Threads

  1. Is this code an API? Beginner learning to write an API and decoupling.
    By Learning2Java in forum Java Theory & Questions
    Replies: 3
    Last Post: April 22nd, 2014, 12:59 PM
  2. jdbc instrumentation using 'asm' byte code manipulation framework
    By Rashmi123456 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: September 25th, 2013, 09:58 AM
  3. In need of API
    By Flamz in forum Java Theory & Questions
    Replies: 1
    Last Post: April 7th, 2013, 08:45 AM
  4. Bytecode Instrumentation
    By rohitdhall07 in forum Java Theory & Questions
    Replies: 2
    Last Post: July 28th, 2011, 10:22 AM
  5. Difference between Speech API and Sound API
    By zeeshanmirza in forum Java SE APIs
    Replies: 1
    Last Post: October 22nd, 2009, 12:22 AM