2

I am currently taking Java lessons and I am using VSCode. I wrote this code:

class Simple{  
    public static void main(String args[]){  
     System.out.println("Hello World!");  
    }   }

But the thing is every time I run my code a message appears:

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS D:\Visual Studio Code\Java Practice>  & 'c:\Users\user\.vscode\extensions\vscjava.vscode-java-debug-0.26.0\scripts\launcher.bat' 'ripts\launcher.bat' 'C:\Users\user\AppData\Local\Programs\AdoptOpenJDK\bin\java.exe' '-Dfile.encoding=UTF-8' '-cData\Roaming\Code\Usep' 'C:\Users\user\AppData\Roaming\Code\User\workspaceStorage\3be13cab7faa4596286e209d09d9be11\redhat.java\jdt_ws\Java Practice_fb59611a\bin' 'Simple' Hello World! PS D:\Visual Studio Code\Java Practice>

I only want to see my output, which in this case is 'Hello World!'. Is there a way to remove the other lines?

1 Answer 1

1
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "java",
            "name": "Debug (Launch) - Current File",
            "request": "launch",
            "args": "",
            "console": "internalConsole",
            "mainClass": "${file}"
        },
    ]
}

Add this to your launch.json file. The important option for you here is "console": "internalConsole", This will output everything to the Debug Console tab and not terminal. And it will look clean like this.

Output in debug console

2
  • I added it to my launch.json file as you said but it didn't solve it, I am still getting the same thing.
    – OmarZalat
    Commented Jun 13, 2020 at 18:10
  • does you launch.json have any other configurations? if so choose this when you are launching, otherwise to test, remove everything and paste just this and try.
    – tHeSiD
    Commented Jun 14, 2020 at 7:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .