Skip to content

Strange Console Output in VSCode Terminal for Java Code Execution #4006

Closed
@cmd-bo

Description

@cmd-bo

Strange Console Output in VSCode Terminal for Java Code Execution

I'm encountering an issue when running Java code in Visual Studio Code. The output in the integrated terminal is not displaying correctly. Specifically, when I run a simple "Hello World" program in Java, the output appears as gibberish or is missing entirely.

The same code works perfectly when executed in an external terminal (CMD), but the issue persists in the VSCode integrated terminal.

Environment:
VSCode Version: 1.98.2
JDK Version: OpenJDK 17.0.14 (2025-01-21)
Operating System: [Windows 10]

Image

Extensions Installed:
Java Extension Pack
Language Support for Java(TM) by Red Hat
Debugger for Java

Additional Information:
I tried setting the java.debug.settings.console to integratedTerminal, and it did not resolve the issue.
I added various VM arguments (e.g., -Xlog:disable), but the issue persists.
Restarting the terminal sometimes restores the correct output, but it reverts back to the issue after re-running the code.

i used a simple print out code :

public class code1 {

    public static void main(String[] args) {
        System.out.println("hello world");
    }
}

the output :

PS D:\coddeeee>  d:; cd 'd:\code'; & 'C:\Program Files\Eclipse Adoptium\jdk-17.0.14.7-hotspot\bin\java.exe' '-XX:+ShowCodeDetailsInExceptionMessages' '-cp' 'C:\Users\ksa54\AppData\Roaming\Code\User\workspaceStorage\c464b3fa11c8c4ffe8ac1c98f25acbde\redhat.java\jdt_ws\coddeeee_ea30c6a5\bin' 'code1'
hello world1c8c4ffe8ac1c98f25acbde\x5credhat.java\x5cjdt_ws\x5ccoddeeee_ea30c6a5\x5cbin' 'code1' ;26467956-25f2-493c-bdf7-a3ffc378354c

Image

Could you provide guidance or a fix to ensure that the output of Java programs is correctly displayed in the VSCode integrated terminal?

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