Skip to content

[1.57.0] Java projects on network drives are not recognized #4550

Open
eclipse-jdtls/eclipse.jdt.ls
#4006

Description

@bbanjjoo

Description

After upgrading Language Support for Java(TM) by Red Hat to version 1.57.0:

Creating a new Java project in a local folder works correctly.

Creating a new Java project on a network drive creates the project files, but VS Code reports that no Java projects are found and prompts me to create a new Java project.

After downgrading the extension to version 1.56.0, the issue disappears.

Expected behavior:
Java projects on network drives should be recognized correctly, just like local projects.

Activity

  1. menthil commented on Oct 19, 2026

    @menthil

    I'm hitting the same problem on 1.57.0 (JDT LS 1.62.0), with an existing Maven project rather than a new one. Downgrading to 1.56.0 fixes it.

    Setup: Windows, folder opened as X:\...\project, where X: is a mapped drive for \\<server>\<share>. The Maven project is in a subfolder (project\project-java\pom.xml), and there is only one pom.xml in the workspace.

    Symptoms:

    • Java Projects view: "No Java projects found in the current workspace"
    • Main class reported as "a non-project file, only syntax errors are reported"
    • Run does nothing

    Log:

    Importing Maven project(s)
    Failed to import Maven project at \\<server>\<share>\...\project\project-java\pom.xml - a project with the same name already exists (check for duplicate groupId/artifactId)
    Build projects fail: Cannot find projects from given uris. []
    

    "Java: Import Java Projects into Workspace" shows: "1 Maven project(s) could not be imported due to duplicate groupId/artifactId."

    Notes: the log shows the project under the UNC path, while VS Code uses the drive letter. Opening the folder directly through the UNC path also failed on 1.57.0, and cleaning the language server workspace did not help.

  2. mamilic commented on Nov 12, 2026

    @mamilic
    Contributor

    Hi @bbanjjoo, @menthil try out this extension, I had a lot of issues with java stack for vscode and descided to build my own.

    https://marketplace.visualstudio.com/publishers/bitno

    Still early development, most of features work, review are welcome, write an issue if you find something that bothers you and I'll try to fix it promptly.

  3. ago1024 commented on Nov 25, 2026

    @ago1024

    Same error here on a local drive with no network share. On my machine it's triggered by a mismatch in drive-letter case, so the problem doesn't look limited to UNC/mapped drives.

    Environment

    • Windows 11 Pro (10.0.26200)
    • Language Support for Java(TM) by Red Hat 1.58.0 (also present in 1.58.0, not only 1.57.0)
    • Maven for Java 0.46.0, Project Manager for Java 0.27.7
    • Multi-module Maven project at D:\<path>\project\pom.xml

    Log

    [error] Failed to import Maven project at d:\<path>\project\pom.xml - a project with the same name already exists (check for duplicate groupId/artifactId) []
    

    Observation

    • The Maven view shows the root project as d:\<path>\project\pom.xml (lowercase drive letter).
    • The Java Projects view shows it as D:\<path>\project (uppercase drive letter).
    • So the same project seems to get registered twice under two path spellings that differ only in drive-letter case. The second import then fails with the duplicate-name error.

    Reproducibility

    • Happens on every VS Code restart.
    • "Java: Clean Java Language Server Workspace" fixes it only until the next restart.
    • Opening the folder explicitly with an uppercase drive letter (code "D:\<path>\project") doesn't prevent it either.

    Downgrading to 1.56.0 fixes it for me.

    My guess is that the path comparison or URI normalization introduced in 1.57.0 is case-sensitive for the Windows drive letter, and probably doesn't resolve UNC vs. mapped-drive paths either. That would explain both the original report and the UNC case @menthil described.

  4. wenytang-ms commented on Dec 2, 2026

    @wenytang-ms
    Contributor

    We investigated and reproduced this locally on Windows (JDT.LS 1.63.0 / redhat.java 1.58.0 with embedded JDK 25 vs. JDK 21) and found two underlying issues in JDT.LS:

    1. JDK 25 File.getCanonicalPath() resolves Windows mapped drives to UNC paths (causing the 1.56.0 → 1.57.0 regression when upgrading the embedded JRE from 21 to 25):

      • On JDK 21, File.getCanonicalPath() for X:\... returns X:\....
      • On JDK 25, File.getCanonicalPath() resolves X:\... to \\server\share\... (while Path.toRealPath() keeps X:\...).
      • Because JDT.LS (ResourceUtils.canonicalFilePathFromURI via Eclipse FileUtil.canonicalPath) resolves workspace/project paths through File.getCanonicalPath(), JDT.LS operates on \\server\share\... (device = null) while VS Code and any existing workspace metadata use X:\... (device = "X:"). That path mismatch causes IWorkspaceRoot.getContainerForLocation(...) to miss existing projects and re-trigger imports (producing Failed to import Maven project ... a project with the same name already exists and Build projects fail: Cannot find projects from given uris. []).
    2. Direct UNC paths (\\server\share\...) drop the server host in ResourceUtils.canonicalFilePathFromURI:

      • When opening a UNC folder directly (file://server/share/...), ResourceUtils.canonicalFilePathFromURI strips query parameters via new URI(uri.getScheme(), null, uri.getPath(), null, null), which discards uri.getAuthority() (server).
      • Paths.get(uri) then treats /share/... as a local path (e.g. C:\share\...), failing with Cannot create linked resource. Local location '...' does not exist. and leaving projects unrecognized.

    Workaround

    For mapped drives, pointing java.jdt.ls.java.home to a JDK 21 installation and running Java: Clean Java Language Server Workspace restores 1.56.0 behavior.

    We are preparing a fix upstream in eclipse-jdtls/eclipse.jdt.ls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions