I can use jps to list running java processes and use jstack -l process_id to get a stack information of a running java process. I want to know this process runs on which java version. Is there a way to do it? I don't have to use jstack tool. thanks.
jstack -l 23819 2014-11-12 12:36:11 Full thread dump OpenJDK 64-Bit Server VM (23.25-b01 mixed mode):
"Attach Listener" daemon prio=10 tid=0x000000000272f800 nid=0x614b waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers: - None
You can do it via jcmd, like this:
jcmd process_id VM.version