title: How to add referenced library JAR files using relative path for eclipse Java project in vscode
body: <p>I checked this <a href="https://stackoverflow.com/questions/50232557/visual-studio-code-java-extension-howto-add-jar-to-classpath">question</a> and many other posts to help me resolve my issue, but nothing worked.</p>
  <p>I trying to open an existing Java Project from Eclipse in vscode. The project was opened successfully in Eclipse 2021-06 and I fixed the referenced libraries by selecting the JAR libraries under <code>lib/</code> folder and right-click - configure build batch - add select add to build path. Then the file <code>.classpath</code> was updated automatically. Then I had to download JDK 11 (needed for vscode) and JDK 1.8 needed for the Java project. I managed to work with eclipse to set the JDK correctly and all worked fine. I was able to compile the project, export the result JAR and deploy and all worked well.</p>
  <p>I am having trouble to open this project in vscode using <code>Open Java Project</code> option. I am facing issues adding referenced libraries this Java project as it is a managed project (since it was created in Eclipse). When I try to add the libraries using vscode UI, I am getting mixed results and sometimes it is not working and the build fails. I was surprised as in some instances, things just work, and then they don't.</p>
  <p>I tried to update <code>.classpath</code> file in vscode and still same issues. When I try to add the libraries from <code>Referenced Libraries (Read Only)</code> under <code>JAVA PROJECTS</code> tree in vscode by clicking <code>+</code>, it has no effect. This step will modify the file <code>settings.json</code> under <code>.vscode</code> folder by adding the relevant values to the property <code>&quot;java.project.referencedLibraries&quot;</code>.</p>
  <p>I am confused about how to configure the referenced libraries for Java projects in vscode. Following is a summary of questions:</p>
  <ol>
  <li>How to add a library using a relative path to a Java Project based on the project root folder?</li>
  <li>What is the difference between adding a library using the <code>.classpath</code> file and by modifying <code>settings.json</code> file? Which one will win?</li>
  <li>How to add a folder with all JAR files to be as the referenced library to the Java Project? This is to avoid adding one file at a time.</li>
  <li>Why the <code>.classpath</code> and <code>.project</code> files are not showing in vscode explorer view? It will only show when you open the file in vscode from the Windows File Explorer.</li>
  <li>I found command <code>Configure Classpath</code> but it is read-only, which I think it is the same as the <code>.classpath</code> file. Is there a way to change it from vscode UI?</li>
  <li>When I remove <code>.classpath</code> file or when I removed the <code>classpathentry</code> lines from the <code>.classpath</code> file, the node 'Referenced Libraries (Read Only)' under <code>JAVA PROJECTS</code> in vscode view was removed. Why?</li>
  </ol>
  <p>See the snapshots below for more details.</p>
  <p>I appreciate your help.</p>
  <p><a href="https://i.stack.imgur.com/sO9Wy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sO9Wy.png" alt="enter image description here" /></a>
  <a href="https://i.stack.imgur.com/1urah.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1urah.png" alt="enter image description here" /></a></p>