Exception in thread "main" java.lang.NoClassDefFoundError: [message #231666] |
Wed, 18 April 2007 00:29 |
jadoo83
Messages: 26 Registered: October 2006 Location: Mumbai
|
Junior Member |
|
|
Hi,
I am in learning phase of java and I am practicing the simple java programs.
I have created a package pack1 in which i have my father class.
Outside of the package i have son class & test class. These all three got compiled. Now when i am executing the test class then i am getting this error
Exception in thread "main" java.lang.NoClassDefFoundError: test (wrong name: pac
k1/test)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
my father class code is as
package pack1;
class father
{
private int a;
int b;
protected int c;
public int d;
}
====================
my son class code is as
package pack1;
class son extends father
{
void show()
{
System.out.println("b= "+b);
System.out.println("c= "+c);
System.out.println("d= "+d);
}
}
====================
my test class code is as
package pack1;
class test
{
public static void main(String args[])
{
father f=new father();
System.out.println("b= "+f.b);
System.out.println("c= "+f.c);
System.out.println("d= "+f.d);
}
}
i have set classpath=.;D:\j2sdk1.4.1_01\bin
What should i do?
[Updated on: Wed, 18 April 2007 01:25] Report message to a moderator
|
|
|
|
|
|