Search code examples
javajvmeclipse-tptp

unable to run jvm with attached profiler


I am unable to start jvm with attached profile on linux with following command:

java -Xverify:none -agentlib:JPIBootLoader=JPIAgent:server=enabled;CGProf TestClass

I am getting following error:

Error occurred during initialization of VM
agent library failed to init: JPIBootLoader
CGProf: command not found

On windows aforementioned command runs successfully and I get message from main method of the class.

linux details

uname -a Linux michael 3.8.0-19-generic #29-Ubuntu SMP Wed Apr 17 18:16:28 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

LD_LIBRARY_PATH=/home/michael/eclipse/tptp/agntctrl.all_platforms-TPTP-4.7.2/linux_em64t/lib/:/home/michael/eclipse/tptp/linux.gtk.x86-TPTP-4.7.2/plugins/org.eclipse.tptp.platform.jvmti.runtime_4.6.3.v201102041710/agent_files/linux_em64t/

TPTP_AC_HOME=/home/michael/eclipse/tptp/agntctrl.all_platforms-TPTP-4.7.2/linux_em64t


Solution

  • The semi-colon is causing problems. In linux ; is the separator between two seperate commands on the same line. Rather than interpreting things as a single command it thinks its two commands

    java -Xverify:none -agentlib:JPIBootLoader=JPIAgent:server=enabled;
    

    and

    CGProf TestClass
    

    both are failing. Try using double quotes which will prevent the shell from splitting it up

    java -Xverify:none -agentlib:"JPIBootLoader=JPIAgent:server=enabled;CGProf" TestClass
    

    you might need to experiment with the best place to put the quotes.