corvax
corvax

Reputation: 1145

Launch java server vm by default

I have both Client VM and Server VM on my machine.

$ java -client -version
Java HotSpot(TM) Client VM

$ java -server -version
Java HotSpot(TM) Server VM

By default Client VM is used:
$ java -version
Java HotSpot(TM) Client VM

I'm trying to launch some java applications (like glassfish, teamcity, upsource etc.), by none of these launches, because they can't open listening connection, because they are being launched by Client VM, so I think I need to set java Server VM by default.

Does anybody knows how to do that?

Upvotes: 0

Views: 118

Answers (2)

Holger
Holger

Reputation: 298469

I don’t know what kind of launcher you have used, but it is very unlikely that these applications ran on a client JVM as their launchers usually select a server JVM by default.

However, you have been misguided by the names as these JVM types have nothing to do with the question of whether the application can opening listening connections. These two JVM shapes just alter the behavior regarding performance. Simply said, a server JVM is optimized for long running applications, but this difference is about to vanish in future JVMs anyway, so then you will never have to worry about “server” vs. “client” JVMs anymore.

So if your application can’t opening a port for listening, the possible reasons are

  • The operating system does not allow it (e.g. certain ports might require administrator privileges)
  • The SecurityManager of the JRE does not allow it (due to its policy)
  • The port is already in use

But it’s not because your JVM is a so-called “client” JVM.

Upvotes: 1

SubOptimal
SubOptimal

Reputation: 22983

The decision it based on your hardware and operating system. For an overview have a look here: Server-Class Machine Detection

Upvotes: 0

Related Questions