Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:could not create the Java Virtual Machine Error:A fatal exception has occured.Program will exit

Tags:

java

java-8

I have just installed Java SE Development Kit 8u91 on my 64 bit Windows-10 OS. I set my path variables . I tried java --version in my command prompt it gave me an error.

c:\Users\Onlymanu>java --version Unrecognized option: --version     Error: Could not create the Java Virtual Machine.  Error: A fatal exception has occurred. Program will exit. 

But when i tried java -version it worked.

I tried initializing _JAVA_OPTIONS environment variable and ever tried re-installation none of them worked. Can any one help me please?

like image 943
Maheshwar Reddy K Avatar asked May 12 '16 11:05

Maheshwar Reddy K


People also ask

How do you fix error could not create the Java Virtual Machine error a fatal exception has occurred program will exit?

Unrecognized option: --version Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. You can try installing JDK 9 or any version later and check for java --version it will work.

Could not create a Java Virtual Machine a fatal exception occurred?

Many users describe encountering the same Could not create the Java virtual machine error when launching an application. Try setting up a new system variable for Java, to see if it makes any difference. You should also run the software as an administrator as the lack of rights can trigger the error.


2 Answers

I think you have put command like java -VERSION. This is in capital letters You need to put all command in lowercase letters

javac -version java -version 

All characters must be in lowercase letter

like image 105
Dhaval Dalsania Avatar answered Oct 08 '22 02:10

Dhaval Dalsania


I was facing a similar issue. Actually the command is :

java -version and not java --version. 

You will get output something like this:

java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode) 
like image 24
Saumya Agnihotri Avatar answered Oct 08 '22 01:10

Saumya Agnihotri