Windows error 2 occurred while loading the Java VM Fix

While installing or launching any software installed on the windows system, which needs a java environment throws an error message on a LaunchAnywhere window that reads “Windows error 2 occurred while loading the Java VM”.

This has been reported by many Windows users recently and they are unable to resolve this, which is affecting their productivity since they cannot open or install some required software.

This can possibly be occurred because of outdated java that has been installed on the system or maybe the wrong Java JDK path entered into the environment variables. After analyzing the possible reasons behind this error including those mentioned above, we have compiled a few fixes which will probably resolve this error easily.

If you are also going through the same problem with your system, please read this article which is going to guide you in fixing it.

Fix 1 – Add Java Run Environment Path to the Path Variable to the system

By providing the correct Java run environment path to the path variable of the system, this type of error can be resolved easily. We suggest our users check if the correct java path has been added to the path variable to the system.

Here are the steps on how to do it.

Step 1: Press the Win + R keys together to open the run command box.

Step 2: Type systempropertiesadvanced in it and press Enter key.

 

Systempropertiesadvanced Run 11zon

 



Step 3: This will open the System Properties window with the Advanced tab.

Step 4: Now click Environment Variables… at the bottom as shown in the below screenshot.

 

Environment Variables 11zon

 

Step 5: In the Environment Variables window under the System Variables section, double-click on the variable called Path as shown below.

 

Path Variable 11zon

 

Step 6: In the new window, click New on the top right side for adding the java path to the Path variable.

Step 7: Then paste the below line into the textbox and click OK.

C:\Program Files\Java\jre1.8.0_333\bin

 

Enter New Java Path 11zon

 

Step 8: Click OK on both the windows (Environment Variables window and the System Properties window).

Fix 2 – Delete the javapath variable from System Variables

If there is any variable specifically named javapath in the environment variables on the system, this might create a conflict because this path is already been provided to the path variable. So let us check if there is any Javapath variable and then delete it from the environment variables on the system.

Step 1: Press the Win + R keys together to open the run command box.

Step 2: Type systempropertiesadvanced in it and press Enter key.

 

Systempropertiesadvanced Run 11zon

 

Step 3: This will open the System Properties window with the Advanced tab.

Step 4: Now click Environment Variables… at the bottom as shown in the below screenshot.

 

Environment Variables 11zon

 

Step 5: In the System Variables section at the bottom, check if there is any variable named javapath.

Step 6: If it is present, then select the javapath variable and click Delete as shown below.

Step 7: Next, click OK to close all the windows that are open.

 

Delete Javapath

 

Fix 3 – Use the LAX_VM command to install the software without error

If this error is occurring while installing any software on the system, then it can be avoided by trying to install the software using the command prompt and with the command that includes the LAX_VM parameter.

If you are wondering how this should be done, don’t worry we are going to explain it in detailed steps below.

Step 1: Open the command prompt window by pressing Win+R keys together and typing cmd and then pressing Enter key.

 

3 Run Cmd Optimized

 

Step 2: Now the command prompt window appears on the system.

Step 3: Type cd C:\Users\%username%\Downloads and press Enter key.

Step 4: This will take you to the Downloads folder in the command prompt.

NOTE – Usually, all the setup file for installing any software that was downloaded from the internet is saved in the Downloads folder. But if the installer file is stored at a different location, then please specify that location path in place of C:\Users\%username%\Downloads in the above command. For eg:- cd <path of the installer file>

Step 5: Now you have reached the folder where the installer file is present.

Step 6: Type the below command and press Enter key.

installer-filename LAX_VM "C:\Program Files\Java\jre1.8.0_341\bin\java.exe"

 

NOTE – Replace installer-filename with the actual filename and replace C:\Program Files\Java\jre1.8.0_341\bin\java.exe with the path of the java.exe file stored on your system. As you update the Java on your system, the jre1.8.0_341 folder name also gets updated with the latest version name.

 

Install Lax Vm Command 11zon

 

Step 7: This will begin installing the software you wanted to install without causing any error.

Fix 4 – Update Java by installing the latest version

Sometimes, outdated java or installing the wrong version of java can create such errors mentioned above in this article. So we recommend checking if the java is updated to the latest version and if not, please install the newer version with the help of the steps explained below.

Step 1: Press the Win+R keys together, type control and press Enter key.

 

Open Control Panel Run Command Min

 

Step 2: Now click Java after selecting the Large icons option from the View by dropdown menu.

 

Click Java Control Panel 11zon

 

Step 3: This will open the Java Control Panel window.

Step 4: Under the General tab, you need to click the About… button to check which version of java is installed as shown below.

 

Click About Java 11zon

 

NOTE – In the About Java window, you can see the version of Java installed on the system as shown below.

 

About Java 11zon

 



Step 5: After checking the version, open your web browser application on the system such as chrome, firefox, etc.

Step 6: Now open a new tab in the browser and paste the below URL in the address bar and press Enter key.

 

https://www.java.com/en/download/

 

Step 7: On the Java downloads page, you will get to see the latest version of Java as shown below.

 



Verify Java Version In Webpage 11zon

 

Step 8: If this version does not match with the one installed on your system, click the Download Java button to start downloading the executable file for installing the latest java.

 

Download Java 11zon

 

Step 9: Once the java executable setup file is downloaded, click on it to start installing the latest java on the system.

 

Click Java Setup File 11zon

 

Step 10: In the Java Setup window, click the Install button present at the bottom, which starts installing java as shown below.

 

Install Java 11zon

 

Step 11: Wait till the installation process is still in progress.

Step 12: Once it gets successfully installed, close the window by clicking Close as shown below.

 

Close Java Installation 11zon

 

Now your system has the latest version of Java installed.