package signIn;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
public class programMain {
public static void main(String[] args) {
System.out.println("heloo");
}
}
Asked
Active
Viewed 47 times
-4
-
What is it? What does your stack trace show? – andrewdleach Aug 15 '15 at 05:29
-
Error: Could not find or load main class signIn.programMain – Divya Aug 15 '15 at 05:31
-
1Do you have a main method in your code? How did you compile? – andrewdleach Aug 15 '15 at 05:32
-
public class programMain { public static void main(String[] args) { } – Divya Aug 15 '15 at 05:33
-
1possible duplicate of [What does "Could not find or load main class" mean?](http://stackoverflow.com/questions/18093928/what-does-could-not-find-or-load-main-class-mean) – Maximillian Laumeister Aug 15 '15 at 05:37
-
i searched here- but it doesnt give me a solution- am not able to compile a println message also code snippet – Divya Aug 15 '15 at 05:41
-
package signIn; import signIn.EventHandler; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.events.EventFiringWebDriver; public class programMain { public static void main(String[] args) { // TODO Auto-generated method stub System.out.print("heloo"); } } – Divya Aug 15 '15 at 05:41
-
Without the rest of your code and a stack trace of the error it is difficult for myself or anyone else to help you. Please edit your original question with all applicable code – andrewdleach Aug 15 '15 at 05:44
-
The code is fine. Now describe all the steps you follow to compile and run the class. If using eclipse, make sure the Problems view is opened, and doesn't contain any compilation error. Fix them all before even trying to run anything. – JB Nizet Aug 15 '15 at 05:56
-
i added this code in eclipse-- and try to clcik on run button. getting error like "Error: Could not find or load main class signIn.programMain".when i run other java classes in the same package, it is running fine- only tis is having issue – Divya Aug 15 '15 at 06:00
-
1Have you opened the Problems view? Have you checked it doesn't have any error? My guess is that the useless imports are referencing classes that are not in the project build path, preventing it to compile. – JB Nizet Aug 15 '15 at 06:03
1 Answers
0
The code itself is fine, the problem is likely to be with the imports, masked by your IDE.
If Eclipse can't get hold of the imports (Have you added them to your build path? Are you using a dependency management tool such as Maven?), it will not be able to compile your code. Unfortunately, Eclipse's behaviour gets a little unpredictable when that happens - it may try to run outdated class files from the last successful build. You may find that cleaning your project (Project > Clean...) will give you a different, more useful, error.
Remove the two (unused) imports and the code should run fine. Of course you'll need to figure out why the dependency was unavailable if you want to actually use Selenium.

hugh
- 2,237
- 1
- 12
- 25