Home > Net >  Getting error File cannot be resolved to a type for java in visual studio code
Getting error File cannot be resolved to a type for java in visual studio code

Time:09-17

I am using 1 main class and 1 interface and attached my pseudo code for lambda expressions:

Below is how it looks like:

enter image description here

Below is simple interface:

enter image description here

I am not doing any IO operations so Why do I get the error "File cannot be resolved to a type"?

does not help me.Tried few more options like clean build project. restarting vs code but not helping. Looking for suggestions to fix this java 8 error. Doing java 8 for first time.

CodePudding user response:

My Source code does not contain any file operations so importing java.io.file was not helping me.

I did Ctrl Shift P(Command Pallete) -> Clean Java server language workspace-> Restart and delete.

This solved the error. Its quite weird that Visual studio code sometimes not build workspace properly. I assumed earlier that it happens only with eclipse old versions but it do happens with new vs code editors as well.

  • Related