Re: Java Reflection question
Things to think about:
What classloader should load the superclass ?
If that is one of your custom classloaders, is it looking in the right place ?
If that is not the same as the classloader which loads "SubClass", is the
intended classloader set as the parent of the custom classloader ?
What are the package names of the various classes ? Does your classloader know
how to map package names onto directory names ?
Hey Thanks!
it is a customized class loader. The file to be loaded(SubClass.java)
is in a directory (subdir). class SubClass extends class 'SuperClass'
also defined in SubClass.java
something like this:
-----------------------------------------------------------------
class SuperClass {
public int cadence;
public int gear;
public int speed=7;
public SuperClass(int startCadence, int startSpeed, int startGear)
{
gear = startGear;
cadence = startCadence;
speed = startSpeed;
}
}
public class SubClass extends SuperClass {
public int seatHeight;
public SubClass(int startHeight, int startCadence, int startSpeed,
int startGear) {
super(startCadence, startSpeed, startGear);
seatHeight = startHeight;
}
public void disp() {
System.out.println(" Speed : " + speed);
System.out.println("hi!");
}
}
----------------------------------------------------------------------
i get the NoClassDefFoundError for SuperClass. If however, I remove
the inheritance(SuperClass) and just keep the SubClass, The loader
works fine.Do I have to separately load the SuperClass as well?