Vladimir Šor
Vladimir Šor

Reputation: 119

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 during OnLoad phase in JVMTI?

Upvotes: 4

Views: 259

Answers (2)

Neil Wightman
Neil Wightman

Reputation: 1133

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.

Upvotes: 0

Konrad Reiche
Konrad Reiche

Reputation: 29513

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).

Upvotes: 1

Related Questions