accessing VM command line from code

A

angelochen960

Hi,

Is there a way to access VM command line parameters from a java code,
particularly a servlet ? Thanks

A.c
 
G

Giovanni Azua

if you know the process id beforehand and assuming Unix environment then you
only need to execute:

"$JAVA_HOME/bin/jps -v | grep <pid>"

jps also works remotely so you can specify the remote host to connect to.

HTH,
regards,
Giovanni
 
A

Arne Vajhøj

Is there a way to access VM command line parameters from a java code,
particularly a servlet ? Thanks

The best I can find is:

RuntimeMXBean rtmb = ManagementFactory.getRuntimeMXBean();
for(String s : rtmb.getInputArguments()) {
System.out.println(s);
}

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top