How to get the full command line in JVMTI?
Is it possible to get full command line with all arguments which was used to launch current Java process and to get that durin开发者_Go百科g OnLoad phase in JVMTI?
I have consulted the JVMTI reference and I think that it is not natively provided, I guess your best shot is to use Byte Code Instrumentation (BCI).
Its not possible to get the pull path but on Oracle JVMs you could use
char * res;
jvmti->GetSystemProperty("sun.java.command", &res);
to get the main class and arguments.
You can use java.class.path too, so with both you can discover quite a lot about how the command started.
精彩评论