Reputation: 484
I am trying to specify some GC tuning options on the command line and for some reason keep running into the 'Unrecognized option' error.
java -Dproperty1=value -Dproperty2=value2 -cp ./some/jarFile1.jar:./some/jarFile2.jar com.xyz.ClassFile -c /path/to/a/file –XX:+UseG1GC -XX:+UseStringDeduplication -XX:MaxGCPauseMillis=200
returns
Exception in thread "main" org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -XX:+UseStringDeduplication
Same thing with the XX:MaxGCPauseMillis
option if I removed StringDeduplication.
Running Java 8, version info:
java version "1.8.0_66" Java(TM) SE Runtime Environment (build 1.8.0_66-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Any clues appreciated.
Upvotes: 1
Views: 1445
Reputation: 298459
Be careful when entering characters. The dash before your –XX:+UseG1GC
is not the ASCII hyphen/minus, but the “En Dash” character.
If you look closely in the browser view of your question, you might notice a difference in length and vertical position, e.g. when comparing with the -XX:+UseStringDeduplication
option. However, that depends on the actual font and it is not unlikely that both characters look the same in the editor/console where you entered the command line.
For java command line options, you have to always use the ASCII hyphen/minus character (U+002D
) which should be the default when pressing - on an ordinary keyboard.
Upvotes: 5