This issue occurs when you are trying to run your main() method with respective class, its looking for the exact .class file in the class path.During the execution the .class file is not available in the class path. The best way to resolve this is, add the .class file into classpath.
There are many possible diagnosis you can do in your Eclipse for this issue. As per the Eclipse behaviour when you are updating the classpath (Build Path) , your class is getting compiled that time and the .class file got created. So, Be careful when doing the build path for your project.
Also check your Build Path, if any jar file is missing. Because, its might causes sometime.
In my case I just found the jar file missing in the build path , and I removed the missing jar and added new jar file from other location.Then executed my class with main method and it works. Below screenshot shows my issue.............
Hope it will help you.
- Severe Catalina Starting Issue
- Java OutOfMemory Error
- java.lang.Error: Unresolved compilation problems
- Failed to execute goal org.apache.maven.plugins
- How to fix hibernate LazyInitializationException
- Why mocking is null after @InjectMocks
- How to mock private fields of a class for JUnit testing