Libraries not imported when editing Eclipse project in VS Code

430 Views Asked by At

So, I've been trying to edit my Java Eclipse project in VS Code. I installed the "Extension pack for Java" extension and tried to open my projects. Loading .jar files and JavaSE works great, but it seems it cannot load the "org.lejos.ev3.ldt.LEJOS_EV3_LIBRARY_CONTAINER". Is there any way how to tell VS Code what its value is?
When I open any of my files containing anything from that library, VS Code cannot resolve imports from that library: screenshot of the import error
Here is how importing anything from java and jar files works:

My .classpath file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
    <classpathentry kind="con" path="org.lejos.ev3.ldt.LEJOS_EV3_LIBRARY_CONTAINER"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="lib/ascs-libs.jar"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

My .project file:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>ASCS-Vehicle</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.lejos.ev3.ldt.leJOSEV3Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.lejos.ev3.ldt.leJOSEV3Nature</nature>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
    <filteredResources>
        <filter>
            <id>1666344409294</id>
            <name></name>
            <type>30</type>
            <matcher>
                <id>org.eclipse.core.resources.regexFilterMatcher</id>
                <arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
            </matcher>
        </filter>
    </filteredResources>
</projectDescription>
1

There are 1 best solutions below

1
JialeDu On

In the JAVA PROJECTS panel, click the plus sign to the right of Referenced Libraries to add a local .jar file.

enter image description here