Tuesday, 2 September 2014

error for could not find or load main class , error for main class not load in java, could not find or load mian class in java program, error for could not find in java

Error: Could not find or load main class test_simple


       I am new to Java and try to running a simple program named "simple" but facing the below error at runtime. I have set the CLASSPATH and PATH variable in the system. .java and .class files are in the same directory and in the cmd prompt, I am running from this directory only. class name and the file name are also same.
Error: Could not find or load main class testpkg.simple
package test_simple;
public class simple 
{
public static void main(String args[])
{  
System.out.println("Welcome to package");
} 
}
Class file Loc: "D:\testpkg" Running as: D:\testpkg>java testpkg.simple Path Var: C:\Program Files\java\jdk1.7.0_67\bin; C:\Program Files\java\jdk1.7.0_67\jre Class path: .;D:\testpkg Windows: xp sp3
It is working if removing "package jav.testpkg;" from the program. it looks like something is wrong with package but unable to point out, gone through many articles and came to this point but still no luck! Your help appreciated!

0 comments:

Post a Comment

 
Copyright © . StackOverflow - Posts · Comments
· Powered by Sanjay Chauhan