Description
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:
- Go to 'Command Palette'
- Click on '> Java: Create Project'
- Click on 'Maven create from archetype'
- Click on 'maven-archetype-quickstart'
- Click on '1.5'
- Enter your 'group_id', 'artifact_id', 'destination folder' when prompted.
- 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:
- Very similar, but I am not trying to override the variable set at the OS level:
maven.terminal.useJavaHome doesnt work if JAVA_HOME already set by shell startup scripts #495