I'm using javassist on a model: com.project.model.Model I've tried various combinations of how the Strings should be formatted for the ClassPath and the CtClass, but to no avail.
ClassPool pool = ClassPool.getDefault();
String setClassPath = "/com/project/model/";
pool.insertClassPath(setClassPath);
CtClass ctClass = pool.get("Model.java");
How should these Strings be formatted? I am using WebSphere Application Server 8.5.5.1, JVM 1.7, spring-webmvc 3.2
Thanks in advance.
Figured it out by grabbing the classpath of the an instance of Model:
Model model = new Model();
ClassPool pool = ClassPool.getDefault();
ClassClassPath ccpath = new ClassClassPath(model.getClass());
pool.insertClassPath(ccpath);
CtClass ctClass = pool.get("com.project.Model");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With