Friday, April 24, 2015

Could not find the main class. Program will exit

        Could not find the main class. Program will exit

Problem: Try to launch any Java application and if we get problem "Could not find the main class. Program will exit" with below dialog.




Analysis: If you are getting above problem. And still JRE is installed in your system. Check below things for the root cause:
  1. Check the "Path" environment variable in your system. Is it having java executable path. And what is the version of Java it is pointing. Found that it is pointing to the JAVA 1.6
  2. Is your classpath pointing to your application jars or .class files?
  3. What is version of Java used to build your source code? Found that it is used Java 1.5 to build the source file.

Solution / Conclusion: This kind of problem will occur if you build /compile the source files with lower version of Java and trying to execute with higher version of Java.

Example: if you build the source files with Java 1.5 and trying to run that program/application with Java 1.6 you will get this problem.

No comments:

Post a Comment