I’ve setup a Java project in Visual Studio Code. I installed previously a few java extensions :
and I can create a program that does Hello World.
In a folder called lib inside the project folder, I copied some jars (lwjgl3) and, although are shown by intellisense when I try to import them, I have an error that says it cannot find the package :
Anything I missed ?
2
Answers
You need to add the jar to your classpath. The classpath is something used by java to find the libraries your program uses. Java looks in each folder/jar archive to find the class files, because it would be slow if it searched every directory on your computer. See this question: What is a classpath and how do I set it?
Add a reference to the package in the following way.
Click the plus sign to the right of Referenced Libraries under the JAVA PROJECTS panel
Select the
.jar
file in the pop-up window.