How can I know program arguments that IntelliJ IDEA was started with from my plugin?

I was unable to find any information of the platform service to know program launch arguments the platform was launched with.
Is there any documentation on the general platform services available?

Thanks,
Ann.

0

I have the least knowledge about these things but FWIW in the directory named bin directly under your installation folder there is a file named idea.exe.vmoptions which contains the VM parameters for both client, and separately, server modes. You can view this filein Notepad or equivalent.

I *think* that's where Community gets its runtime VM parameters  from.

0

What do you want to accomplish? Normally, when a user runs IntelliJ IDEA, they do not specify any arguments.

0

Simone, thank you for pushing me in the right direction!!
The idea.exe.vmoptions and idea.properties are close to what I am looking for... The file seems to be generated by exe4j, not sure I can get access to it.
From the plugin, I can get access to the contents of the idea.exe.vmoptions with the help of:


RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
List<String> vmOptions = runtimeMxBean.getInputArguments();


Although, there are no program arguments that I specify in the 'Program Arguments' field when I launch a slave instance of IDEA.
To get these arguments, I had to call:


String[] commandLineArguments = IdeaApplication.getInstance().getCommandLineArguments();

And it worked! Thanks again to everyone!

0

Thanks Dmitry,

That is the main point.
Specifying arguments on the command line seems to give an error anyways.
So the only way to pass something with the command line is to specify some -D java property, I got it.

Thanks,
Ann.

0

请先登录再写评论。