Whether options can be used due to different Java versions

The other day, there was a scene where I used a different PC than usual. When I tried to check the Java version that was included, I got the following error. ..

Terminal


$ java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

––The version option is not recognized? Can't create a Java virtual machine? ?? Fatal error? ?? ??

When I thought it was strange, I found the following article.

https://stackoverflow.com/questions/37186197/errorcould-not-create-the-java-virtual-machine-errora-fatal-exception-has-occu

Apparently you can use ––vesion after JDK9, Before JDK8, it seems to be useless unless it is –version. With one hyphen difference. .. When checking the Java version, the following that works with any version is better ◎

Terminal


$ java -version

Recommended Posts

Whether options can be used due to different Java versions
Rails tutorial When rails new cannot be done due to different versions
[Java] char type can be cast to int type
Tomcat cannot be started due to java version change
About the function of Spring Boot due to different versions
Java 14 new features that could be used to write code
Static analysis tool that can be used on GitHub [Java version]
Summary of ORM "uroboroSQL" that can be used in enterprise Java
Java arguments to run with gradle run can be specified with --args (since Gradle 4.9)
Introduction to Java that can be understood even with Krillin (Part 1)
Java to be involved from today
Java file input / output processing that can be used through historical background
Whether to use Java Comparable or Comparator
How to switch Java versions on Mac
Initial settings until S2Dao can be used
How to switch between multiple Java versions
Technology excerpt that can be used for creating EC sites in Java training