49

I tried java --version in the command line and I get :

Unrecognized option: --version
Error: Could not create the Java virtual machine
Error: A fatal exception has occurred. Program will exit.

Everything was working fine until I installed jre 7 (I had jdk 1.6 preinstalled ) So, I uninstalled the previous versions, restarted and then installed fresh jdk 7u5 windows i586.

Still I get the same problem. Can anyone help me with this?
I am unable to install and run maven for this reason.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Deepak behera
  • 651
  • 1
  • 5
  • 8

2 Answers2

121

You used two - marks. Try with one: java -version.

Update: Since Java 9 java and javac commands support both --version and -version.

Pshemo
  • 122,468
  • 25
  • 185
  • 269
4
java -version

This is the command to get the current installed version info

Anuj
  • 119
  • 8