Custom loading class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pb2000
    New Member
    • Apr 2010
    • 13

    Custom loading class

    Hello,
    I have problem with ObjectInputStre am.ReadObject() method.
    Code below
    Code:
    FileClassLoader externalLoader = new FileClassLoader(currentTaskDir);
    Class c = externalLoader.loadClass(className);
    Method mlist[] = c.getDeclaredMethods();
    Object[] objectsPassed = null;
    objectsPassed = (Object[])ois.readObject();
    Object examinedObj = objectsPassed[0];
    String methodName = (String)objectsPassed[1];
    in main directory I have directory "currentTaskDir " with class "ClassName".cla ss.
    Class c is loaded with custom loader from currentTaskDir directory.
    Nevertheless, reading ObjectInputStre am takes into account only classes from classpath. I do not want to add currentTaskDir to classpath, because of further reloading class.
    objectPassed is group of String and ClassName (c). How can I cast ois.ReadObject( ) to String and c?

    Thank You for answers. I will be grateful for them.
    Paul
Working...