开发者

How to get the full command line in JVMTI?

开发者 https://www.devze.com 2023-04-11 04:51 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消