0

Note: this is not a question about server or client Java applications. It's about the client and server versions of the HotSpot VM.

I am currently using Eclipse 4.2 and Oracle's Java 1.7, though this applies to all versions of Java and Eclipse.

  • If I use Eclipse's Run button to execute a Java class, with no extra configuration, will it run the client or server VM?
  • I know that I can set these individually with VM options, but if I want to change the setting for my whole project, without having to configure each class, where can I do that? (For example, it's defaulting to client but I want to make sure it runs server.)
  • Does the Debug button run a different VM than the Run button? I imagine it's probably harder to attach a debugger to the server VM. Are both supported for debugging or will it always run the client VM, for example?

Looking for an authoritative answers to this question, supported by facts. Thanks!

Andrew Mao
  • 35,740
  • 23
  • 143
  • 224

1 Answers1

1

If I use Eclipse's Run button to execute a Java class, with no extra configuration, will it run the client or server VM?

It will run on workspace default JRE with the vm arguments provided in the "installed JRES" configuration pane (see below)

I know that I can set these individually with VM options, but if I want to change the setting for my whole project, without having to configure each class, where can I do that? (For example, it's defaulting to client but I want to make sure it runs server.)

Go to window >preferences >installed JRES (edit the JRE you are using to launch) add server to default vm arguments

This will apply to all the launch configurations you'll make (by executing a java class from eclipe).

I don't think there is a way to bind JRE vm arguments to all launch configurations for a specific project.

Does the Debug button run a different VM than the Run button?

You can choose to (by editing your debug configuration). By default I think it uses the workspace default JRE

user18428
  • 1,216
  • 11
  • 17