Artifact f88f41363740fabadf41b03902ca21f4c2df02553377625453f9dea0ce51acce:
- Executable file
r37/lisp/csl/jlisp/JlispClassLoader.java
— part of check-in
[f2fda60abd]
at
2011-09-02 18:13:33
on branch master
— Some historical releases purely for archival purposes
git-svn-id: https://svn.code.sf.net/p/reduce-algebra/code/trunk/historical@1375 2bfe0521-f11c-4a00-b80e-6202646ff360 (user: arthurcnorman@users.sourceforge.net, size: 1690) [annotate] [blame] [check-ins using] [more...]
// 26/02/02 Load a class and return an instance of it. import java.io.*; import java.lang.reflect.*; public class JlispClassLoader extends ClassLoader // ClassLoader { Object loadMyInstance(String className, byte [] bytes) { //ByteArray.printBytes(bytes); try { Class newClass = defineClass(className, bytes, 0, bytes.length); resolveClass(newClass); return newClass.newInstance(); } catch (VerifyError e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (ClassFormatError e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (InstantiationException e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (IllegalAccessException e) { Jlisp.println("Error: " + e); return null; } } Object loadMyInstance(String className) { try { Class newClass = loadClass(className, true); return newClass.newInstance(); } catch (VerifyError e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (ClassNotFoundException e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (InstantiationException e) { Jlisp.println("Error: " + e); return Jlisp.nil; } catch (IllegalAccessException e) { Jlisp.println("Error: " + e); return null; } } } // end of JlispClassLoader.java