Reputation: 351
I am trying to create project example with VS Code using Project Manager for Java (as part of the Extension Pack for Java, by Microsoft). On this short tutorial there is a run button, but for me I only see debug button:
Why is this and how can I fix it?
Upvotes: 1
Views: 104
Reputation: 1275
We changed the shortcut button from run to debug several months ago. So the tutorial is out-of-date: https://github.com/microsoft/vscode-java-debug/pull/1108
But if you really want to run your application instead of debug. You can still right-click on your project and find the run action.
Upvotes: 1
Reputation: 9291
I open a Java/Maven project in my VSCode(updated to the latest 1.74.3), it also show a add and debug in the Java Projects view.
But it is easy to run the main application directly in VSCode.
Open the application class which includes a static main
method, there is a run/debug icon in the top right location of the title bar. Click it to run your application directly or select run or debug from the dropdown menu.
Create a custom launch.json
file. Click the Debug icon in the left pane to show Run/Debug view, and if there is no launch.json existed, it will guide to create one. In the launch.json
file, setup a Launch Main task.
{
"version": "0.2.0",
"configurations": [
{
"type": "java",
"name": "Launch Main",
"request": "launch",
"mainClass": "com.example.demo.Main",
"projectName": "demo"
}
]
}
Then in the title bar of Run/Debug view, there is a dropdown box which includes a Launch Main task, click it and run your application.
Upvotes: 1