christopher
christopher

Reputation: 27336

JVM Command Line Option

I'm trying to change the garbage collector on the server's JVM to combat a java.lang.OutOfMemoryError: GC overhead limit exceeded exception, as per some of the other questions I've found on here. Although I've ran into some confusion about the usage of these command line options. This is what I'm doing:

java -XX:+UseConcMarkSweepGC

However I'm getting the usage message, and no indication it has changed at all.

This is the output I'm seeing:

Usage: java [-options] class [args...] (to execute a class) or java [-options] -jar jarfile [args...] (to execute a jar file) where options include: ........

Is this the correct use of the command line arguments? Am I making a stupid mistake? (it happens a lot)

Upvotes: 2

Views: 2386

Answers (1)

mikołak
mikołak

Reputation: 9705

Command line flags like that one are used by the JVM you create when running the java command, they're not "global" switches.

To use the flag, include it in the VM arguments of your normal execution.

Also, note that enabling ConcMarkSweepGC will not really help you, since all that it enables it potentially more proactive garbage collection. You either have:

Upvotes: 2

Related Questions