'Can't Run Java in VSCode?
What would cause VS Code to not run java debugging or show any output for java? The JAVA_HOME variable is set, in both the user environment and in the VSCode settings, to the OpenJDK 16.0.1 installation folder. I can open command prompt and run "java -version" and get info, but VS Code doesn't want to do anything with it.
The logs I get from the extension host are (sorry for the text wall, I tried to make it easier to read):
[2021-09-28 11:23:08.248] [exthost] [info] extension host started
[2021-09-28 11:23:08.325] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication {"startup":false,"extensionId":{"value":"vscode.microsoft-authentication","_lower":"vscode.microsoft-authentication"},"activationEvent":"onAuthenticationRequest:microsoft"}
[2021-09-28 11:23:08.325] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/microsoft-authentication/dist/extension.js
[2021-09-28 11:23:08.343] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch {"startup":true,"extensionId":{"value":"vscode.debug-auto-launch","_lower":"vscode.debug-auto-launch"},"activationEvent":"*"}
[2021-09-28 11:23:08.343] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/debug-auto-launch/dist/extension
[2021-09-28 11:23:08.349] [exthost] [info] ExtensionService#_doActivateExtension vscode.git {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-09-28 11:23:08.350] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/git/dist/main
[2021-09-28 11:23:08.395] [exthost] [info] WSL is not installed, so could not detect WSL profiles
[2021-09-28 11:23:08.448] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug {"startup":false,"extensionId":{"value":"ms-vscode.js-debug","_lower":"ms-vscode.js-debug"},"activationEvent":"onCommand:extension.js-debug.clearAutoAttachVariables"}
[2021-09-28 11:23:08.448] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.js-debug/src/extension.js
[2021-09-28 11:23:08.596] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication {"startup":false,"extensionId":{"value":"vscode.github-authentication","_lower":"vscode.github-authentication"},"activationEvent":"onAuthenticationRequest:github"}
[2021-09-28 11:23:08.596] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/github-authentication/dist/extension.js
[2021-09-28 11:23:08.630] [exthost] [info] ExtensionService#_doActivateExtension vscode.github {"startup":true,"extensionId":{"value":"vscode.github","_lower":"vscode.github"},"activationEvent":"*"}
[2021-09-28 11:23:08.631] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/github/dist/extension.js
[2021-09-28 11:23:08.660] [exthost] [info] eager extensions activated
[2021-09-28 11:23:08.661] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet {"startup":false,"extensionId":{"value":"vscode.emmet","_lower":"vscode.emmet"},"activationEvent":"onStartupFinished"}
[2021-09-28 11:23:08.661] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/emmet/dist/node/emmetNodeMain
[2021-09-28 11:23:08.675] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict {"startup":false,"extensionId":{"value":"vscode.merge-conflict","_lower":"vscode.merge-conflict"},"activationEvent":"onStartupFinished"}
[2021-09-28 11:23:08.675] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/merge-conflict/dist/mergeConflictMain
[2021-09-28 11:23:08.682] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender {"startup":false,"extensionId":{"value":"ms-vscode-remote.remote-wsl-recommender","_lower":"ms-vscode-remote.remote-wsl-recommender"},"activationEvent":"onStartupFinished"}
[2021-09-28 11:23:08.682] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode-remote.remote-wsl-recommender/dist/extension.js
[2021-09-28 11:23:08.697] [exthost] [info] ExtensionService#_doActivateExtension vscode.testing-editor-contributions {"startup":false,"extensionId":{"value":"vscode.testing-editor-contributions","_lower":"vscode.testing-editor-contributions"},"activationEvent":"onStartupFinished"}
[2021-09-28 11:23:08.697] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/testing-editor-contributions/dist/extension.js
[2021-09-28 11:23:15.451] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.node-debug2 {"startup":false,"extensionId":{"value":"ms-vscode.node-debug","_lower":"ms-vscode.node-debug"},"activationEvent":"onDebugInitialConfigurations"}
[2021-09-28 11:23:15.451] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.node-debug2/out/src/extension
[2021-09-28 11:23:15.459] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.node-debug {"startup":false,"extensionId":{"value":"ms-vscode.node-debug","_lower":"ms-vscode.node-debug"},"activationEvent":"onDebugInitialConfigurations"}
[2021-09-28 11:23:15.459] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/ms-vscode.node-debug/dist/extension.js
[2021-09-28 11:23:17.729] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-server-ready {"startup":false,"extensionId":{"value":"vscode.debug-server-ready","_lower":"vscode.debug-server-ready"},"activationEvent":"onDebugResolve"}
[2021-09-28 11:23:17.729] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/debug-server-ready/dist/extension
[2021-09-28 11:23:24.396] [exthost] [info] ExtensionService#_doActivateExtension vscode.configuration-editing {"startup":false,"extensionId":{"value":"vscode.configuration-editing","_lower":"vscode.configuration-editing"},"activationEvent":"onLanguage:json"}
[2021-09-28 11:23:24.396] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/configuration-editing/dist/configurationEditingMain
[2021-09-28 11:23:24.409] [exthost] [info] ExtensionService#_doActivateExtension vscode.extension-editing {"startup":false,"extensionId":{"value":"vscode.extension-editing","_lower":"vscode.extension-editing"},"activationEvent":"onLanguage:json"}
[2021-09-28 11:23:24.409] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/extension-editing/dist/extensionEditingMain
[2021-09-28 11:23:24.420] [exthost] [info] ExtensionService#_doActivateExtension vscode.json-language-features {"startup":false,"extensionId":{"value":"vscode.json-language-features","_lower":"vscode.json-language-features"},"activationEvent":"onLanguage:json"}
[2021-09-28 11:23:24.420] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/json-language-features/client/dist/node/jsonClientMain
[2021-09-28 11:23:24.448] [exthost] [info] ExtensionService#_doActivateExtension vscode.npm {"startup":false,"extensionId":{"value":"vscode.npm","_lower":"vscode.npm"},"activationEvent":"onLanguage:json"}
[2021-09-28 11:23:24.448] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Program Files/Microsoft VS Code/resources/app/extensions/npm/dist/npmMain
[2021-09-28 11:23:26.464] [exthost] [info] ExtensionService#_doActivateExtension redhat.java {"startup":false,"extensionId":{"value":"redhat.java","_lower":"redhat.java"},"activationEvent":"onLanguage:java"}
[2021-09-28 11:23:26.465] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/smj11/.vscode/extensions/redhat.java-0.82.0/dist/extension
[2021-09-28 11:23:26.622] [exthost] [error] Activating extension redhat.java failed due to an error:
[2021-09-28 11:23:26.624] [exthost] [error] Error: EEXIST: file already exists, mkdir '\\file-server1.test.domain.com\Users\'
at mkdirSync (fs.js:925:3)
at Object.e.mkdirSync (electron/js2c/asar_bundle.js:5:12016)
at c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:75623
at Array.reduce (<anonymous>)
at h (c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:75564)
at Object.u.getStream (c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:74586)
at new _ (c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:973625)
at Object.t.initializeLogFile (c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:586222)
at t.activate (c:\Users\smj11\.vscode\extensions\redhat.java-0.82.0\dist\extension.js:2:559378)
at Function._callActivateOptional (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:14382)
at Function._callActivate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:14051)
at c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:12203
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Promise.all (index 0)
at async h.$activate (c:\Program Files\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:91:19131)
[2021-09-28 11:23:29.210] [exthost] [info] ExtensionService#_doActivateExtension vscjava.vscode-java-debug {"startup":false,"extensionId":{"value":"vscjava.vscode-java-debug","_lower":"vscjava.vscode-java-debug"},"activationEvent":"onLanguage:java"}
[2021-09-28 11:23:29.210] [exthost] [info] ExtensionService#loadCommonJSModule file:///c:/Users/smj11/.vscode/extensions/vscjava.vscode-java-debug-0.35.0/dist/extension
Solution 1:[1]
It seems you are using windows. I don't know the concrete reason, but I solved a similar error putting the code in a local unit.
Network units/shares, unless mapped in windows, are prone to errors with this extension in my experience.
Solution: copy the source code to a local unit and try.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | gavioto |