Getting “Error: JAVA_HOME not found in your environment” when attempting to create a new Maven project in VSCode

We Are Going To Discuss About Getting “Error: JAVA_HOME not found in your environment” when attempting to create a new Maven project in VSCode. So lets Start this Java Article.

Getting “Error: JAVA_HOME not found in your environment” when attempting to create a new Maven project in VSCode

  1. Getting “Error: JAVA_HOME not found in your environment” when attempting to create a new Maven project in VSCode

    Control Panel-> System-> Advanced system settings-> Environment
    Variables:
    Under User variables, Choose Path, click New:
    Copy the path of the JDK bin directory.

  2. JAVA_HOME not found in your environment” when attempting to create a new Maven project in VSCode

    Control Panel-> System-> Advanced system settings-> Environment
    Variables:
    Under User variables, Choose Path, click New:
    Copy the path of the JDK bin directory.

Solution 1

1.Add java to PATH:

Control Panel-> System-> Advanced system settings-> Environment
Variables:

Under User variables, Choose Path, click New:

Copy the path of the JDK bin directory. enter image description
here

Open Command Prompt, and run java --version. If there’s no error
shown and you get the right jdk information, turn to the next step;

2.Install Java Extension Pack in VS Code;

3.Press Ctrl+Shift+P to open Command Platte and choose Java: Configure Java Runtime:

Turn to Java Tooling Runtime and select your installed jdk, JDK
for Language Server is equivalent to java.home: enter image
description here

Then reload VS Code to make change effective.

Original Author Of This Content

Solution 2

I have manage to configure this entirely through Visual Studio Code. Using the reference for the Maven extension: https://marketplace.visualstudio.com/items?itemName=vscjava.vscode-maven

I set my Java home path in Visual Studio Code, like this (inside of settings.json):

"java.home": "C:\\Program Files\\Java\\jdk-9.0.4"

And then you can enable Maven to use the same path with the settings below:

"maven.terminal.useJavaHome": true

Original Author Of This Content

Solution 3

The solution to this problem was setting both a user Path variable and a new system variable “JAVA_HOME” specifically to the address of the bin folder of my Java 11 installation.

In my case the path looked like this:
C:\Program Files\AdoptOpenJDK\jdk-11.0.8.10-hotspot\bin

I have a hunch that my issue may have related to the fact that I have two JDKs installed- one for Java 8 and one for Java 11- but I’m not sure.

Thank you to those who helped!

Original Author Of This Content

Conclusion

So This is all About This Tutorial. Hope This Tutorial Helped You. Thank You.

Also Read,

Siddharth

I am an Information Technology Engineer. I have Completed my MCA And I have 4 Year Plus Experience, I am a web developer with knowledge of multiple back-end platforms Like PHP, Node.js, Python and frontend JavaScript frameworks Like Angular, React, and Vue.

Leave a Comment