Eclipse not recognizing Classes and Strings in Java – Error: Could not find or load main class StaticDemo

Spread the love

Hello friends,

Maybe you are a beginner in Java or maybe having some experience in Java development, you might have encountered this weird error in Eclipse IDE.

The error when Eclipse refuses to recognize Classes and String in it and gives error “Error: Could not find or load main class StaticDemo”. This is the case when Eclipse not recognizing Classes and Strings.


This is common error occurs in Eclipse when the Java JREs are not properly linked with Eclipse IDE., hence you find eclipse not recognizing Classes and Strings in your IDE.

The solution for Eclipse not recognizing Classes and Strings in java:

To remove this error in Eclipse,

Step 1: Go to Eclipse menu -> select Windows -> Preferences -> Java -> Installed JREs.





Step 2: Check whether the JREs are available or not. If not click on “Add” button and add the installed JRE library by browsing the JRE installation location in your machine and select the checkbox present before the JRE jar.








Step 3: Click OK.




This should solve the problem if still, you see the error follow below next steps.


Step 1: Right click on project folder -> Properties -> Java Build Path -> Libraries.




Step 2: Check the required JRE library is present or not.






Step 3: If not present click on Add Library… button -> click JRE System Library -> Click Next -> Workspace default JRE.





After these steps error should get removed from your Eclipse IDE. If still not, then try to recreate a project folder or reinstall your Java setup and restart the eclipse.

Subscribe here by email for more tutorials:


Spread the love

Leave a Comment