3

I am trying to debug Java code which is only hello world program.

public class Hello
{
   public static void main(String[] args)
   {
      System.out.println("hello world");
   }
}

The code above has no error. But Visual Studio Code keeps warning this message to me even though the code has no error. But every time when I click Proceed, Visual Studio Code can debug Java code successfully.

enter image description here

I don't really know which build is failed.

And this is my launch.json for Java debugger. Did I set it up correctly?

{
    "type": "java",
    "name": "Java",
    "request": "launch",
    "cwd": "${workspaceFolder}",
    "console": "integratedTerminal",
    "stopOnEntry": false,
    "mainClass": "Hello",
    "args": ""
},

In the mainClass, I can just use "mainClass": "Hello" as usual to debug Java code after saving the file as Hello.java, and use javac Hello.java to build Hello.class.

I really don't know which build is failed or if it is a bug in Java debugger.

Could you please help me fix this problem?

Community
  • 1
  • 1
Liu Bei
  • 565
  • 3
  • 9
  • 19
  • Did you solve the problem ? How ? – CABascourt Dec 12 '18 at 19:33
  • Hi, I have solved the problem. There are 2 ways to solve. First, use Maven. Second, press Ctrl + Shift + P, and you type Java in it. You will see create Java project. Both ways will give you classpath file which is the requirement. Also, you must have Java Extension from Microsoft installed. – Liu Bei Dec 20 '18 at 20:32
  • 1
    Does this answer your question? [How can I fix build failed, do you want to continue? in vscode](https://stackoverflow.com/questions/50454523/how-can-i-fix-build-failed-do-you-want-to-continue-in-vscode) – rafalimaz Oct 28 '21 at 18:01

2 Answers2

0

Try deleting the Java Language Server workspace directory. Here's where they are generally found depending on your OS.

Windows

%APPDATA%\Code[ - Variant]\User\workspaceStorage\

MacOS

$HOME/Library/Application Support/Code[Variant]/User/workspaceStorage/

Linux

$HOME/.config/Code[Variant]/User/workspaceStorage/

You can find more information regarding cleaning your workplace here. Cleaning vscode java workplace

rlwheeler
  • 518
  • 4
  • 12
  • Thank you for sharing the solution. I have tried what you said, but the problem just disappeared for a moment, and then there is the same problem again. It seems this is only temporary solution. If you have another way, please tell me. – Liu Bei Jul 28 '18 at 13:02
0

I think this is a bug of vs code.

delete the file in /Users/airren/Library/Application Support/Code/User/workspaceStorage can fix this problem, but you may be lost your workspace.