我目前正在尝试学习VSCode。我现在正在使用VSCode在Java 11中进行编程。在下面的示例代码中,有4行导入。他们中的前两个正在工作。但是其中的下两个出现了以下错误。
package app;
import java.util.*;
import java.awt.*;
import com.google.common.primitives.Ints;
import org.apache.commons.collections.iterators.ArrayIterator;
/**
* Board_Space
*/
public class Board_Space {
}
"The import com.google cannot be resolved. Java(268435846) [5,8]"
"The import org.apache.commons.collections cannot be resolved. Java(268435846) [6,8]"
如何解决此错误以及如何使用任何种类的外部库?
Related Environment Info:
- OS: Windows 10
- JDK 11 is installed. JAVA_HOME and PATH environment variables are set.
- apache-maven-3.6.1 is installed. MAVEN_HOME and M2_HOME environment variables are set.
- VSCode Version: 1.36.1 (user setup)
- VSCode Commit: 2213894ea0415ee8c85c5eea0d0ff81ecc191529
Extensions:
- Name: Checkstyle for Java / Id: shengchen.vscode-checkstyle
- Name: Code Spell Checker / Id: streetsidesoftware.code-spell-checker
- name: Debugger for Java / Id: vscjava.vscode-java-debug
- Name: Java Dependency Viewer / Id: vscjava.vscode-java-dependency
- Name: Java Extension Pack / Id: vscjava.vscode-java-pack
- Name: Java Test Runner / Id: vscjava.vscode-java-test
- Name: Language Support for Java(TM) by Red Hat / Id: redhat.java
- Name: Maven for Java / Id: vscjava.vscode-maven
- Name: Visual Studio IntelliCode / Id: visualstudioexptteam.vscodeintellicode