microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.62k stars 28.67k forks source link

Java Unresolved compilation problems: cannot to import jar libraries #74570

Closed loretoparisi closed 5 years ago

loretoparisi commented 5 years ago

Steps to Reproduce:

  1. Create the .project file:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>musixmatch_nlp</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>
  1. Create the .classpath file:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="/Users/loretoparisi/lib/stanford-corenlp-3.9.1-models.jar"/>
    <classpathentry kind="lib" path="/Users/loretoparisi/lib/stanford-corenlp-3.9.1.jar"/>
    <classpathentry kind="lib" path="/Users/loretoparisi/lib/xom.jar"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>
  1. Run a java main with
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Objects;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
// CoreNLP is in the library path
import edu.stanford.nlp.pipeline.StanfordCoreNLP;

//...
public class Main {

    public static void main(String[] args) throws IOException {
             // initialize StanfordCoreNLP
            Properties logger_properties = new Properties();
       StanfordCoreNLP pipeline = new StanfordCoreNLP(properties);
           //...
        }
}
  1. Got an error:
Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    StanfordCoreNLP cannot be resolved to a type

Does this issue occur when all extensions are disabled?: Yes/No YES

kieferrm commented 5 years ago

Pls file the issue against the Java extension. Thanks!

vscodebot[bot] commented 5 years ago

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

loretoparisi commented 5 years ago

Okay I have filed he issue here https://github.com/microsoft/vscode-java-pack/issues/155