Today when I open Eclipse it shows me errors on a lot of rows. What happened?
Asked
Active
Viewed 129 times
0

Robin Green
- 32,079
- 16
- 104
- 187

SlaaSh
- 99
- 1
- 6
-
Please provide more details. That's definitely valid Java code. Perhaps you're setting the wrong language (C++?) or use the wrong file extension. What's your Eclipse configuration? – user202729 May 20 '18 at 06:48
-
1And what exactly do the error messages say? – user202729 May 20 '18 at 06:49
-
you mean today or tommorow? – Shanu Gupta May 20 '18 at 06:49
-
In every raws the errors say "*** cannot be resolved" – SlaaSh May 20 '18 at 06:54
-
Have you tried cleaning and rebuilding your eclipse project? – jpllosa May 20 '18 at 07:21
-
Yes i have, but this problem is in all my project – SlaaSh May 20 '18 at 07:24
-
Look at this Q&A: https://stackoverflow.com/questions/16918959/import-cannot-be-resolved. (It is marked as a duplicate, but IMO it isn't) – Stephen C May 20 '18 at 07:31
-
hi, another guy had the exact same problem yesterday- I posted the solution which worked for him – Daniele May 20 '18 at 07:39
-
The symptoms were different. – Stephen C May 20 '18 at 09:13
1 Answers
1
Each of those errors is a compilation error, where the compiler tells you a class is not present in the build path for your project. And of course all of those are classes which are included in the JDK.
Looks like Eclipse lost the workspace main JRE, and that is sometimes due to Java himself updating online overnight, and deleting the old JDK installation. To fix that, restore the workspace JRE and assign it to your project.
To restore the JRE: go to
Window>Preferences>Installed JREs
remove any JRE you have (you probably have one in a red state)
add a new Workspace JRE and make it the default:
Click on Add>Standard VM> As Java home, use the main folder where your JDK is installed.
Reassign it to your project:
Right click on Project>Properties>Java Build Path>Libraries
Remove the current JRE library (if it is in a red state),
Re-assign the JRE:
Select Add Library>JRE System Library>and use the workspace default.
Click on Apply, clean and build your project, compilation should be successful.

Daniele
- 2,672
- 1
- 14
- 20