I'm getting this message in the following scenario:
java.lang.ClassNotFoundException: agents.MemoryAgent
I've bundled, by hand following this link , a java agent class into a jar. For the run/debug configuration I've copied a working entry and added VM arguments.
I've tried both of these (the constant arguments are carried over from the copied config)
-javaagent:agent.jar -Xms256m -Xmx1024m -Djava.net.preferIPv4Stack=true
And
-javaagent:agent.jar -cp . -Xms256m -Xmx1024m -Djava.net.preferIPv4Stack=true
NOTE: pseudonym class used here, real class exists
I've tried putting the agent.jar file into the 'Working Directory' specified above, as well as the 'Project compiler output' directory specified in the project structure/setting dialog.
The entire contents of my manifest.txt file:
Premain-Class: agents.MemoryAgent
Which yields in the META-INF\\MANIFEST.MF file when extracted:
Manifest-Version: 1.0 Created-By: 1.6.0 (Sun Microsystems Inc.) Premain-Class: agents.MemoryAgent
I have verified that the class' path matches that used in the jar and class files.
I'm using:
Why can't it find the class?
In the screenshot a field is titled 'Use classpath of module', but I could not find anywhere that this is defined. Is that relevant?
IDEA will try to find the jar that you have specified in -javaagent, (agent.jar in your case) in the working directory (shown in the above screen). Copying the jar to your "Working Directory" as shown in the above UI will fix the issue. So, for your case, copy the agent.jar to "E:\\Autre\\Projects\\JetBrains"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.