Skip to content

Can't run the java code #870

Closed as not planned
Closed as not planned

Description

@hjue

Environment:

  • VS Code Version: Version: 1.63.2

  • Extension Version:

  • JDK Type & Version: java "17.0.1"

  • OS Type & Version: Mac Monterey 12.1

Step to Reproduce:
Installing extensions
image

Settings for the JDK

image
image
Creating a source code file
image
image

Can't run the java code
image

image

Activity

  1. Eskibear commented on Jan 5, 2022

    @Eskibear
    Member

    From the "spinning sync icon" at bottom right corner, it tells that the language server is starting (e.g. importing your project).

    Can you wait a little longer, or check "Language Support for Java" output channel for detailed logs? If you can stably reproduce the error (e.g. spinning forever), please provide a sample project.

  2. hjue commented on Jan 11, 2022

    @hjue
    Author

    dev tools log screenshot

    client.log

    {
      message: 'Language Support for Java (Syntax Server) server encountered error: [object Object], Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed',
      level: 'error',
      timestamp: '2022-01-11 19:00:50.279'
    }
    {
      message: '[Error - 7:00:50 PM] Connection to server got closed. Server will not be restarted.',
      level: 'info',
      timestamp: '2022-01-11 19:00:50.280'
    }
    
  3. Eskibear commented on Jan 12, 2022

    @Eskibear
    Member

    Looks like it was working on lightweight mode. Jinbo Wang (@testforstephen) Any idea?

  4. github-actions commented on Oct 31, 2025

    @github-actions

    Hi hjue (@hjue), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.

    It looks like this is a known bug where VS Code’s Java extensions fail to activate (no project detected, “command 'java.debug.runJavaFile' not found”).

    • Duplicate issue:
    • #2267 (“Can’t run the java code” on Mac, same VS Code/extension versions)
    redhat-developer/vscode-java#2267

    You can work around it by:

    • Ensure your java.home is the full JDK path including /Contents/Home:

    "java.home": "/Library/Java/JavaVirtualMachines/microsoft-17.jdk/Contents/Home"

    • Run “Java: Clean the Java language server workspace” from the Command Palette and reload the window.
    • Check the Java Language Server output (View → Output → select Language Support for Java).
    • If you see stream errors, try disabling other extensions (e.g., TabNine) to rule out conflicts.

    Other references with high confidence worth checking:

    • #963 (same “command 'java.debug.runJavaFile' not found” error)
    microsoft/vscode-java-debug#963

    Other references with low confidence

    • #1460 (empty folder, win10, cannot run code; similar symptoms)
    microsoft/vscode-java-debug#1460

    • #1003 (JDK uninstall/reinstall on Windows; code runs in terminal but not in VS Code)
    redhat-developer/vscode-java#1003

    The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions