2

Is there some way by which, I can get the list of all supported JVM arguments via some API ?

I am writing a program where i need to merge two files which contain JVM arguments. In existing file i need to put new incoming parameters and also merge the value of parameters on both the sides (preference will be given to already existing value).

So, I want to get a list of all possible JVM arguments which can be present in the file.

I don't want to put a hard coded list as my program will be running across multiple platforms like windows, linux and unix etc. and JVM on each platform can have different list of supported arguments.

So i want to write the program in a way which works across multiple platforms.

Thanks in Advance.

Bagira
  • 2,149
  • 4
  • 26
  • 55
  • This question was already answered. Take a look there: http://stackoverflow.com/questions/1490869/how-to-get-vm-arguments-from-inside-of-java-application – Michal Rorat Jan 03 '14 at 10:22
  • This only returns the arguments passed to current VM. I need list of all possible arguments. – Bagira Jan 03 '14 at 10:43
  • Why? Just merge whatever you find. By definition it must always be correct, and if it isn't it certainly isn't your fault. – user207421 Jan 03 '14 at 11:07

1 Answers1

2

The list of all possible arguments of all possible JVMs is, by necessity, always incomplete, even if you restricted yourself to a range of JVMs from a single vendor. And even if you had one, the next patch would probably allow yet another -X.... option.

What is more, such a list wouldn't tell you if a given combination of command line arguments would be correct for a certain, but unknown, JVM. For this, you would need the intersection of the allowed command line arguments of a set of JVMs. Depending on what versions you want to support, it will probably turn out that you could only have non -X... options, except maybe the most common ones like -Xmx, -Xss and -Xms

Ingo
  • 36,037
  • 5
  • 53
  • 100