'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.
Solution 1:[1]
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": ""
}
Solution 2:[2]
I had the same issue and finally after uninstalling the Java Language Support the problem was resolved. Thank you!
Solution 3:[3]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Julian |
Solution 2 | Sami |
Solution 3 |