VS Code Terminal Java Hide Path

假如想象 提交于 2021-01-24 09:42:26

问题


I'm just starting practicing Java in VS Code. So, when an 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$ 

Thanks.


回答1:


so to do so 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




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/59368671/vs-code-terminal-java-hide-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!