djangofan
djangofan

Reputation: 29669

Does the "-server" option to the JVM need to be the very first option?

Does the "-server" option to the JVM need to be the very first option? I read somewhere that this was the case and I can no longer find the documentation any longer. On the other hand , every single "example" given by Oracle suggests that this is the case. Does anyone know the answer and know what the link is to prove it?

Upvotes: 2

Views: 144

Answers (1)

Jon Lin
Jon Lin

Reputation: 143886

If I write a class with only this in its main method:

System.out.println(System.getProperty("java.vm.name"));

And run it without -server, I get this:

Java HotSpot(TM) Client VM

But if I run it with the -server flag, at anywhere, including the first option or last option, I get this:

Java HotSpot(TM) Server VM

So it appears to not make any difference. Tested this with Oracle's Java 6 and 7.

On linux, using JDK 1.5.0_22, it seems it's defaulted as the server VM. Whether I use -server or not, it comes up as the Server VM unless I use -client, which I can use anywhere on the command line's list of options.

Upvotes: 6

Related Questions