java version command code example Example 1: check java version java --version Example 2: java version command java -version