vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Unable to create a new Java class

Open hildo opened this issue 10 months ago • 4 comments

Attempting to create a new Java class in the File Explorer is failing. Nothing happens.

Version: 1.99.1 Commit: 7c6fdfb0b8f2f675eb0b47f3d95eeca78962565b Date: 2025-04-04T15:58:59.624Z Electron: 34.3.2 ElectronBuildId: 11161073 Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Linux x64 6.8.0-1024-aws snap

Language Support for Java Extension, v 1.41.1

I have an existing Maven project, and I am attempting to create a new Java class in an existing folder to contain a new test.

Steps

  1. Right click the existing package / folder in the src/test part of explorer
  2. Select New Java File / Class
  3. Enter the name of the class at the top of the page and press Enter

Nothing happens. No file is created.

I did see this output in the Extension Host output, but I don't know if it's relevant or not.

2025-04-11 10:38:33.867 [error] SystemError: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory) at userInfo (node:os:365:11) at /home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:457104 at Generator.next () at /home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:454747 at new Promise () at r (/home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:454492) at /home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:456814 at /home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:458044 at Generator.next () at o (/home/me/.vscode/extensions/vscjava.vscode-java-dependency-0.24.1/dist/extension.bundle.js:2:454549)

hildo avatar Apr 11 '25 00:04 hildo

Looks to be happening around https://github.com/microsoft/vscode-java-dependency/blob/84af4b35654fe0167b0bff1d39cd0ccc3d4b07c6/src/explorerCommands/new.ts#L222 .

Does anything from https://github.com/microsoft/vscode-remote-release/issues/9649 or https://github.com/microsoft/vscode/issues/204178 seeml ike your use-case ?

rgrunber avatar Apr 11 '25 16:04 rgrunber

@rgrunber potentially... this is during a remote session. I will read them, follow suggestions and report back. Thank you for pointing this out!

I guess more specific: VSCode is running locally on a Windows machine, but using a remote session against a Linux machine via ssh.

hildo avatar Apr 11 '25 22:04 hildo

I don't know if this helps, but where I am using VS Code on Windows 11, remotely connecting to WLS (Ubuntu) I do not get this issue

Version: 1.99.2 (user setup) Commit: 4949701c880d4bdb949e3c0e6b400288da7f474b Date: 2025-04-10T01:21:25.295Z Electron: 34.3.2 ElectronBuildId: 11161073 Chromium: 132.0.6834.210 Node.js: 20.18.3 V8: 13.2.152.41-electron.0 OS: Windows_NT x64 10.0.26100

Perhaps not completely apples and apples comparison (one is using the WSL extension, then other SSL). But a data point.

hildo avatar Apr 11 '25 23:04 hildo

I actually misspoke. The environment where I am working with a remote connection is working fine. The environment where I am seeing this error is a native Ubuntu environment. No remote sessions involved. I'll still have a look into the workarounds being described, though. Apologies for any confusion

hildo avatar Apr 14 '25 04:04 hildo