vscode-java
vscode-java copied to clipboard
Import Problem : ..cannot be resolved as a type
Hi, I'm new to Java and am using Visual Studio Code (VSCode) for my development. I’ve encountered a problem when creating a package named "robot" located in "src/robot". The Java linter indicates that a class I used from the default package (located in "src") cannot be resolved as a type. I use a makefile to compile my code and I don't use maven or anything else.
Here is the error I have :
Here is my project structure :
Environment
- Operating System: WSL Ubuntu 22.04.4 LTS
- JDK version: 23.0.1
- Visual Studio Code version: 1.94.2
- Java extension version: 0.29.0
[Please attach a sample project reproducing the error] Please attach logs
Current Result
..cannot be resolved as a type
Expected Result
.
Additional Informations
As per the Java Spec, you can't reference classes from the default package, in another package. See https://stackoverflow.com/a/2193298/753170