5

I have a Java .jar running in my system. How can I know which JRE is being used by that .jar? I have multiple JRE's in multiple location.

The which java command produces

/usr/bin/java

$JAVA_HOME is set to /usr/java/jdk-1.6.0

ps -ef produces

\xyzusr     5206     1  0 02:10 ?        00:00:00 ScrapJAR -p -u 2694 -g 15464 -- java -server -XX:+AggressiveHeap -Xms2048m -Xmx2048m -Xss512k
slm
  • 363,520
  • 117
  • 767
  • 871
Vishwanath gowda k
  • 594
  • 1
  • 5
  • 11

1 Answers1

8

The easiest method is to use the command line tool lsof and its -p switch so that you can list what files are being used by this particular process.

$ sudo lsof -p 5206 | grep jre

Example

Here's my Chrome process just to give you an idea of what the output looks like.

$ sudo lsof -p 1376 | head -10
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
COMMAND  PID USER   FD      TYPE             DEVICE  SIZE/OFF      NODE NAME
chrome  1376 saml  cwd       DIR                0,3         0  46546425 /proc/10802/fdinfo
chrome  1376 saml  rtd       DIR                0,3         0  46546425 /proc/10802/fdinfo
chrome  1376 saml  txt       REG              253,1  93187864   1837056 /opt/google/chrome/chrome
chrome  1376 saml  DEL       REG               0,17            46544680 /dev/shm/.com.google.Chrome.1ciABr
chrome  1376 saml  DEL       REG               0,17           127971521 /dev/shm/.com.google.Chrome.t7ByaK
chrome  1376 saml  mem       REG              253,1   3334400   1837130 /opt/google/chrome/lib/libpeerconnection.so
chrome  1376 saml  mem       REG              253,1  17313408   1835692 /opt/google/chrome/PepperFlash/libpepflashplayer.so
chrome  1376 saml  mem       REG              253,1   6842800   1837141 /opt/google/chrome/libwidevinecdm.so
chrome  1376 saml  mem       REG              253,1    780024    559781 /usr/lib64/libsqlite3.so.0.8.6
slm
  • 363,520
  • 117
  • 767
  • 871