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
Exception in thread "main" org.apache.commons.cli.UnrecognizedOptionException: Unrecognized option: -XX:+UseStringDeduplication
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)
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.