I have a .class file in disc. I want to load it dynamically onto jvm using javaassist. but it throwing exception. The following is the code i wrote:
ClassPath cp=new ClassClassPath(ExampleImpl.class);
System.out.println(cp.find(ExampleImpl.class.getName()));
System.out.println("ExampleImpl.java");
System.out.println(ExampleImpl.class.getName());
System.out.println();
CtClass ctClasz = pool.get("***D:\\ExampleImpl***");
ctClasz.addInterface(pool.get(MyInterface.class.getName()));
There is a .class file on the D: drive and evn it is throwing the following exception:
Exception in thread "main" javassist.NotFoundException: D:\ExampleImpl
at javassist.ClassPool.get(ClassPool.java:436)
at javaassist.Demo.main(Demo.java:24)
How to load a .class file on the disc dynamically onto jvm and execute it???