1

I've setup a Java project in Visual Studio Code. I installed previously a few java extensions :

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 :

Error

Anything I missed ?

Razvan
  • 187
  • 1
  • 1
  • 8

2 Answers2

1

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?

0

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

    enter image description here

  • Select the .jar file in the pop-up window.

JialeDu
  • 6,021
  • 2
  • 5
  • 24