I'm using Visual Studio Code for Java and I want to debug my code while using a Library. But whenever I start debugging I'm getting the following error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
IO cannot be resolved
IO cannot be resolved
IO cannot be resolved
at TestClass.main(TestClass.java:6)
for example with the following code:
import AlgoTools.IO;
public class TestClass {
public static void main(String[] args) {
int a, b;
a = IO.readInt("Please enter a number ");
b = IO.readInt("Please enter another number ");
IO.println("Your number is: " + (a + b));
}
}
But when I compile my code in cmd or PowerShell using javac <Filename>
and running it with java <Classname>
it works fine. I'm only getting errors when I try to debug in Visual Studio Code.
I should also mention, that I added the path to my .jar Libary in my CLASSPATH.
I'm using the default "Launch" debugging configuration:
{
"type": "java",
"name": "Debug (Launch)",
"request": "launch",
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopOnEntry": false,
"mainClass": "",
"args": ""
},