8000 Unable to set the JAVA_HOME variable used by the Maven extension · Issue #1061 · microsoft/vscode-maven · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Unable to set the JAVA_HOME variable used by the Maven extension #1061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mhrtr-gh opened this issue Jan 31, 2025 · 3 comments
Open

Unable to set the JAVA_HOME variable used by the Maven extension #1061

mhrtr-gh opened this issue Jan 31, 2025 · 3 comments

Comments

@mhrtr-gh
Copy link

Describe the bug

When launching the maven extension / terminal within VS Code, I get the error:

Error: JAVA_HOME not found in your environment.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

I do not have JAVA_HOME set as a Windows environment variable.

Setting any of "java.home", "java.jdt.ls.java.home", "maven.terminal.useJavaHome", "maven.terminal.customEnv" appears to have no effect, and the error still occurs.

To Reproduce
Steps to reproduce the behaviour:

  1. Go to 'Command Palette'
  2. Click on '> Java: Create Project'
  3. Click on 'Maven create from archetype'
  4. Click on 'maven-archetype-quickstart'
  5. Click on '1.5'
  6. Enter your 'group_id', 'artifact_id', 'destination folder' when prompted.
  7. Check the Maven terminal window for messages

Expected behavior
The Maven terminal picks up the configured JAVA_HOME setting and successfully executes the command.

Environments (please complete the following information as much as possible):

  • OS: Windows 10
  • VS Code version: 1.96.4
  • Extension version 0.44.0

Additional context
I have tried every combination of the following settings in both my User settings.json file and my workspace settings file:

"java.home": "C:\\LocalApplications\\Java\\openjdk\\jdk-18.0.2.1",

"java.jdt.ls.java.home": "C:\\LocalApplications\\Java\\openjdk\\jdk-18.0.2.1",

"maven.terminal.useJavaHome": true, // also tried false, and removing the line entirely

"maven.terminal.customEnv": [
    {
        "environmentVariable": "JAVA_HOME",                // variable name
        "value": "C:\\LocalApplications\\Java\\openjdk\\jdk-18.0.2.1"      // value
    }
],

I exited and relaunched VS Code between each setting change

I have looked at the following related issues, for information, but none of them offer a solution:

@fmeyertoens
Copy link

Setting JAVA_HOME via customEnv works for me:

"maven.terminal.customEnv": [
    {
        "environmentVariable": "JAVA_HOME",
        "value": "C:/development/java/openjdk-1.8.0.201"
    }
],

@mhrtr-gh
Copy link
Author
mhrtr-gh commented Feb 3, 2025

Setting JAVA_HOME via customEnv works for me:

"maven.terminal.customEnv": [
{
"environmentVariable": "JAVA_HOME",
"value": "C:/development/java/openjdk-1.8.0.201"
}
],

Is that on a Windows terminal, or linux?

@fmeyertoens
Copy link

That is on Win11 using PowerShell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0