You can list the threads, find the main thread and scan the stack trace until you find the call to the main one and pull out the arguments.
updating the comment indicates that this will not work on its own, and I think the comment is correct. I forgot about the possibilities of introspection stack or mentally mixed in the JVMTI.
So here is plan B. Connect yourself to the JMX. There are arguments in VM Summary MBean.
Connection name: pid: 77090 com.basistech.jdd.JDDLauncher -config src/main/config/benson-laptop-config.xml
All that you have to do is call System.getProperty and live with the need to use -D to pass parameters from the outside world to your cave.
bmargulies
source share