Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No "referenced libraries" in VS Code Java project

I imported a Java project into Code that was originally developed in Eclipse. At first, the entire "Java Projects" section in the explorer would not appear, but I did a "Clean Java language server workspace" and it appeared. However, "Referenced Libraries" does not appear:

enter image description here

I am not sure why this is the case. When I manually added the jars I wanted to the .classpath file, the "Referenced Libraries" appeared but said "Read-only." Further, doing a workspace clean removed these from the .classpath file, and the "Referenced Libraries" section disappeared again. Am I missing something? What can I do to get "Referenced Libraries" back?

like image 310
lzb Avatar asked Jul 02 '26 14:07

lzb


2 Answers

Remove .classpath and .project files from the project folder. Then put your referenced library (for ex. jar file) file into lib folder. After you restart vscode it will be fixed.

like image 160
sglbl Avatar answered Jul 04 '26 05:07

sglbl


I had this problem and solved it editing the .classpath file directly. After creating a "lib" directory aside "src" and "bin", I wrote a new line like this:

<classpathentry kind="lib" path="lib/yourlibrary.jar">

After that, I opened VScode and it recognized the referenced library.

like image 26
pserey Avatar answered Jul 04 '26 04:07

pserey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!