How to let VS Code know the path to Non-JDK Classes?

176 Views Asked by At

My Java program imports a non JDK class downloaded and placed in the same directory as my Java file. How do I let VS Code know the path to this class so I don't get the red under squiggle for class not resolved error?

Currently when I compile I need to java -cp /path/to/Non-JDK/class.jar MyClass.java is there a way to add /path/to/Non-JDK/class.jar to the search path of the compiler so I can just java MyClass.java?

1

There are 1 best solutions below

0
On

enter image description here

You can click Add icon under JAVA PROJECTS -> Referenced Libraries, it will modify "java.project.referencedLibraries" in the settings.json file automatically, or you can modify it directly.