Java is one of the most popular programming languages of all time. It runs on billions of devices in several applications. All because a Java program, once written can be run on any machine that has JVM installed.
However, that doesn’t mean the language and its compiler is free of errors. If you’re getting the Java Virtual Machine launch error, here’s how you can fix the problem.
How to fix Java Virtual Machine?
Here are three solutions you can try out to resolve the situation.
Run the program as administrator
You should first try running the Java program as an administrator. This can be done simply by navigating to the folder where your program is, right-clicking it and selecting Run as Administrator. This should help with any permission issues JVM might be having.
Create a new system variable for Java
Adding a new system variable will let JVM access Java from anywhere in the system and potentially resolve the error.
Step 1: Press Windows Key + R to open the Run prompt. Type sysdm.cpl and hit enter.
Step 2: Head over to the Advanced tab and click Environment Variables.
Step 3: Click New under System variables.
Step 4: Type _JAVA_OPTIONS in the Variable name field and -Xmx512M in the Variable value field. Click OK when you’re done.
Now restart your PC and try again. JVM should run just fine.
If nothing else works, you will have to remove Java from your PC and reinstall it again to iron out any issues.
Step 1: Press Windows key + X to bring up the quick access menu. Select Apps and Features from this menu.
Step 2: Find Java in the list, click on it and select Uninstall.
Once the uninstaller is complete, you can download Java and reinstall it to fix the problem.
Someone who writes/edits/shoots/hosts all things tech and when he’s not, streams himself racing virtual cars. You can reach out to Yadullah at [email protected], or follow him on Instagram or Twitter.