if your package name is same with your class name this problem will occur.
this happened to me. i noticed that someone said i have to create an entire new workshop! why? because i installed a newer jre version and that won't allow other previous versions to run on it. so all those old files i have become useless in a way. not really, just copy and paste it to new class and change it to an unused class name.
that's because you guys created the class one time with the main method & after that may be you have been deleted that form or workplace & still some of the files exist ,i will suggest you to create that form or workspace again & then delete it by clicking on it completely,then after that if you created the some class like runner class try to run it again.
same problem occur with me.i went to project > properties > java buildpath.
there in order of export , i moved up my java/main to the top priority.
it seems that the class is not compiled by eclipse.
few pointers could be-
- check if the .class file exists in your output folder.to know your output folder right click on project->properties->java build path(check at bottom).
- check if project->build automatically is checked in the menu.
- check if the helloworld class is in src folder or not.right click on project->properties->java build path(check source tab).
i deleted a jar file from the bin directory. right click on your project - properties then libraries tab. there was a red flag in there. i removed the jar file from the libraries and it worked.
i just ran into that problem. the cause... not sure. however, only happened after i added a new jvm. my solution:
- went to run configurations: - run->run configurations
in the classpath tab:
- select advanced
- add where eclipse usually put the *.class for the projects, which is in bin. so i added the bin directory for the project.
i hope it helps someone out there. it took me time to figure this out.
this just happened to me today after updating my jre. i cleaned the project and it started working again.
project -> clean will remove any existing class files and completely rebuild the project. there's more information on eclipse's clean function here.
- Error When Compiling on Eclipse Luna with JavaCC - Could not find or load main class javacc
- Error Could not find or load main class springboot eclipse
- Eclipse Error: Could not find or load main class
- Scala Error: Could not find or load main class in both Scala IDE and Eclipse
- Error: Could not find or load main class in Eclipse
- Could not find or load main class weblogic.server in eclipse
- Eclipse -> Error: Could not find or load main class hello
- eclipse error: could not find or load main class for project
- Could not find or load main class org.testng.remote.RemoteTestNG - in Eclipse
- Java Eclipse Maven Could not find or load main class with jdk
- Error: Could not find or load main class ... - Maven project out of Eclipse
- Error: Could not find or load main class with Spark in Eclipse
- Eclipse won't compile into bin , Could not find or load main class
- java eclipse patched JRE classes Xbootclasspath Could not find or load main class
- Eclipse - Error: Could not find or load main class
- Could not find or load main class Eclipse
- Eclipse IBM Webshpere startup Could not find or load main class VS
- Error running cucumber in eclipse- Could not find or load main class cucumber.api.cli.Main
- Eclipse on OS X El Capitan Error: Could not find or load main class
- Eclipse Error: Could not find or load main class opencv
- Eclipse debugging stopped working: Could not find or load main class
- Error: Could not find or load main class in eclipse IDE after cleaning project
- After converting to maven getting error : Could not find or load main class
- Trying to run a java program in console will give a could not find or load main class error
- Eclipse Error: Could not find or load main class
- Error: Could not find or load main class Mac Eclipse
- error could not find or load main class -eclipse?
- Gradle build error in eclipse: Could not find or load main class Files\OpenJdk11\lib\security\cacerts
- Eclipse IDE Error: Could not find or load main class javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.fxml
- Getting "Error: Could not find or load main class aQute.launcher.Launcher" in Eclipse IDE even though it works in command line
More Query from same tag
- Source code compatibility setting in Eclipse
- No grammar constraints (DTD or XML schema) detected for the document
- Using DCEVM with weblogic 12 and eclipse
- Selection of cell in SWT Tree (multiple columns)
- Async class not passing the argument
- Cocos2d-x-2.2 for Android - create new project on Eclipse
- How do you stop Console from popping up automatically in Eclipse
- missing requirement osgi.wiring.package when starting bundle
- Eclipse ClassPath variable pointing to Windows Environment variable
- Installation failed due to invalid APK file! (when attempting to run emulator) Also fails when attempting to export
- removing dependencies.dependency.version errors
- How do I do commit a renamed file with case-sensitive using TortoiseGit?
- Error: JavaFX runtime components are missing - JavaFX 11 and OpenJDK 11 and Eclipse IDE
- Problem with Eclipse while programming for android - "Refreshing external folders"
- Issue with program for renaming files
- android application authentication ID
- No editor in Eclipse to open Java files with?
- Git Push to remote rejected due to abandon change
- Not able to Install TestNG in Eclipse-Kepler
- Import existing project to heroku
- How do I fix 'Source not found' error when debugging in Eclipse, using Selenium WebDriver?
- Eclipse won't work with android (Mac)
- How to stop Eclipse rebuild workspace?
- Android. Debugging on a real device (Nexus 7)
- Subclipse and JavaHL installation headache
- Eclipse: How to show user who changed this line in CVS?
- GIT with WAMP setup
- Howto debug program that needs to run as root from gdb (Eclipse) as user (set gdb suid root?)
- Eclipse IDE fail to launch with JVM Terminated. Exit code=-1
- Eclipse Tycho: Testing plug-in's without using single test-bundles