简体   繁体   中英

Visual Studio Code won't recognize non-java imports

In my Java application, Visual Studio Code throws the following error for all my non-java imports:

package this.is.a.package does not exist (compiler.err.doesnt.exist)

This error appeared a few days ago. Before that my projects and imports where working just fine. I tried to reinstall VSC several times, rebooted my Mac and deleted all files in $HOME/Library/Application Support/Code/User/workspaceStorage/ as suggested by this feed ( Visual Studio Code - Java - Import Errors and More ). The Java application compiles just fine in IntelliJ IDEA. Therefore, the file structure should be correct.

The error appears after the installation of the Java Language Support ( https://marketplace.visualstudio.com/items?itemName=georgewfraser.vscode-javac ) extension.

I had the same issue and finally after uninstalling the Java Language Support the problem was resolved. Thank you!

Eventually I solved this issue by deleting the content of the settings.json file and replace it with some standard entries.

{
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "files.autoSave": "afterDelay",
    "java.semanticHighlighting.enabled": true,
    "java.jdt.ls.vmargs": "",
    "java.import.gradle.jvmArguments": ""
}

maybe, you can try the "Java Extension Pack" extension in the marketplace. as the 'Language Support for Java(TM) by Red Hat' under the pack can provide you the ability of compile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM