Reputation: 4833
I'm trying to figure out how a system works. When I do a 'ps -A' I see several java processes. Is there a way to run a command that will examine a java instance and let me know what all jars or classes are loaded from that instance (preferably without stopping the instance)?
Upvotes: 0
Views: 88
Reputation: 118
You can use jconsole or visualvm to get the details of the running JVM. These require xwindows if you are using linux.
Further, jps -v will let you know what was the command line argument used to start the JVM. From there you should be able to see what jars where used for the classpath.
Upvotes: 3
Reputation: 5776
In case of Java application server running web or enterprise (EAR) application, you cannot deduce all used jars from command line. But you can use e.g. lsof
command to list all files that given java process is using. And filter jars from them.
Upvotes: 0
Reputation: 14458
ps -Af
Will show you the exact command used to launch the process. It can not, however, tell you exactly which libraries that the invoked JAR file has loaded (although you do presumably get the classpath so you can make inferences).
For more detail you'll need a tool that interrogates the JVM.
Upvotes: 0
Reputation:
You will need to use some Java specific tool such as VisualVM to do what you are inquiring about.
Upvotes: 3