Reputation: 41
I am trying to run Java Programs (beginner) in VS Code. Whenever I try to run the program, it runs in the Terminal Panel. Any way I can change it so the end result is always in the Output/Debug panel.
It makes things a lot easier and cleaner.
I have been looking on the forums and the VSCode site to see if someone has already answered this but it hasn't been yet.
Upvotes: 4
Views: 11819
Reputation: 61
You might be using debugger for java as an extension. You can modify the extension settings within the extension manager. Look for Debugger for Java and press on the settings icon. A list will appear. Press extension settings. There you can change the console specification to what you want. Set it to internalConsole. Go back to your code and run. You will see that it will show up on the Debug Console instead of the integrated terminal.
Upvotes: 6
Reputation: 14956
you could try to add "console": "internalConsole"
in your launch.json like :
"configurations": [
{
"type": "java",
"name": "CodeLens (Launch) - App",
"request": "launch",
"mainClass": "com.test.maven.App",
"console": "internalConsole",
"projectName": "my.app"
}
]
then it will show in Debug Console
Upvotes: 6
Reputation: 1061
On the Visual Studio Code website there is a page that explain the process of doing just that: https://code.visualstudio.com/docs/java/java-debugging
To resume it:
1. Download an extension pack to make it easier
2. Run/Debug
the app (or method) by clicking on the Run | Debug
over the said method. For the whole app click the Run | Debug
over the main()
. You can also press F5
to start the whole thing
Things should display in the Debug
pane now.
Bear in mind that in order to run Java
application you have to run the JVM
which is a progrma in itself. That is why the terminal is usually brought up if you select Run
.
Upvotes: 0