John Doe
John Doe

Reputation: 31

VS Code Terminal Java Hide Path

When the output is displayed in the Terminal, how can I hide all that unnecessary information with the path from showing every time? All I want to see is just my program data.

sh-3.2$ /Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home/bin/java -Dfile.encoding=UTF-8 -cp "/Users/Alex/Documents/My Java Project/bin" app.MyClass 

Enter username
test
Username is: test
sh-3.2$ 

Upvotes: 2

Views: 8065

Answers (6)

Sangram
Sangram

Reputation: 31

First go in preferences-> settings and search for (Java › Debug › Settings: Console) Change its setting from default to (internalconsole) and that's it.

you will get a terminal path free output on debug console

Upvotes: 3

preet
preet

Reputation: 5

Just Enable 'code-runner:Run In Terminal'

Upvotes: 0

Renay Singh
Renay Singh

Reputation: 11

Make sure the Debugger for Java extension is installed. Then go to VS Code Preferences > Extensions > Debugger for Java Change from the drop-down menu from the default integratedConsole to internalConsole

Upvotes: 0

Parvez
Parvez

Reputation: 86

Install Code Runner Extension --> Click on the settings icon on the Code runner extension --> select Extension settings --> Scroll and check for Code-runner: Show Execution Message uncheck it and the reload the Vs Code

Now run any language code java or python, long Path won't be available, Only Output is displayed

Upvotes: 0

jerome
jerome

Reputation: 33

This will work, but you'll run into an error message when using a Scanner object. The best solution I've found so far is to create two configurations in the settings.json file. I have...

{
    "type": "java",
    "name": "In Debugger",
    "request": "launch",
    "mainClass": "${file}",
    "console": "internalConsole"
}

...when I want to run it in the debugger console and have a cleaner output, and...

{
    "type": "java",
    "name": "Int Terminal",
    "request": "launch",
    "mainClass": "${file}",
    "console": "integratedTerminal"
}

...when I need to run it into the terminal.

Though this video shows how to set it up for Python, it works pretty much the same for Java: https://www.youtube.com/watch?v=NSZqn1VrzVc&ab_channel=ReynaldAdolphe

Upvotes: 0

김용희
김용희

Reputation: 1

I was in a situation just like this solutin is

 "console": "internalConsole"

paste this to launch.json
if you want detailed detailed answer click thislink

Upvotes: 0

Related Questions