Visual Studio Code Java Run Without Debugging stucks on "Run: Compiling..." pop-up

Viewed 42

I have a simple Java application with 3 source files. The program compiled and ran fine in the integrated terminal before. Until I tried to use an extension GraalVM for Java or something. Didn't understand how to use that, so I uninstalled it. Now when I use "Run without Debugging" I just get a pop-up saying "Run: Compiling ... Source: Debugger for Java (Extension)" and the program does not start in the integrated terminal. I think this is related to file launch.json which is

{
    "configurations": [
    {
        "type": "java",
        "name": "Launch Current File",
        "request": "launch",
        "mainClass": "${file}"
    }
    ]
}

Do I need some sort of tasks.json file as well and what should go into it? There are a lot of extensions as well and their tasks and relations are not too clear.

  1. Debugger for Java (Microsoft)
  2. Extension Pack for Java (Microsoft)
  3. Gradle for Java, although I seem to have pom.xml as well? I used "Java: Create Javafx project"
  4. Jupyter. I am not doing tests, this is a small project
  5. Language support for Java (Red Hat)
  6. Maven for Java (Microsoft)
  7. Project Manager for Java (Microsoft)

On the left bottom corner, on the tab "Run configuration", all values seem to have values. Should they be set and how?

Have tried:

  • Restarting VSC - no change, stuck on "Compiling ..."

Anything more I should try?

1 Answers

[Solved]:

I removed the launch.json and added tasks.json below

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "java",
            "mainClass": "com.coolapp.App",
            "targetPath": "${workspaceFolder}/${workspaceFolderBasename}.jar",
            "elements": [
                "${compileOutput}",
                "${dependencies}"
            ],
            "problemMatcher": [],
            "label": "java: exportjar:coolapp",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

Also, I noticed (there was a message which I ignored earlier) that there was a Netbeans java language service extension which I uninstalled. The error message btw did not specify which extensions were conflicting so I went on with a guess.

Then I cleaned the Java language server workspace as suggested below. These fixed the issue.

So, it seems you don't necessarily need launch.json. And do not install conflicting extensions.

Related