vishal.aim wrote:I know you are not loading it twice.
Ok, I understand that we cant load JVMTI agent library using System.loadLibrary(). But I think there is some misunderstanding here. First I'm not loading the same library twice. I'm using two agents: javaagent( for accessing premain()) and JVMTI native agent(dll) with java wrapper (to use JVMTI functions for profiling).
I'm loading javaagent jar using command line option (java javaagent:PATH_TO_jar ...). For JVMTI agent I wanted to load library(dll) in code because I want to decide in premain() whether to use JVMTI functions( eg. getCPUTime()) or JDK methods(eg. nanoTime()) for insertion in byte code (for insertion I'm using ASM).java.lang.intrumentation was introduced in 1.5 version of java. If you do not want to use java 6 you can try 1.5.
Is there any alternative for this (apart from using java6)?
One thing I tried was to load both javaagent jar and JVMTI dll library using same command line option (java javaagent:PATH_TO_jar agentlib:JVMTIAgentLibName ...) but it gives some other errors. Can we load both this way?
If this is right, then I can open another thread for this different error.You should be able to load both the agent. Send the error details we will take a look at it. Open a new thread for this.