javassist
javassist copied to clipboard
Can not invoke getDeclaredMethod to get private method on CentOS
My OS is CentOs 7.2.1511 and JDK version is 1.8.0_102,the next code will throw "javassist.NotFoundException: createCommandLine(..) is not found in java.lang.ProcessImpl"
CtClass ctClass = ClassPool.getDefault().get("java.lang.ProcessImpl"); CtMethod method = ctClass.getDeclaredMethod("createCommandLine");
BUT it works well on Windows platform,it gets the private method createCommandLine
successfully.
Can anyone tell me how to fix it?
Thanks.
This is one of those cases where there is a platform-specific implementation that's simply not going to exist on a Linux environment. That's one of the risks you take when you try to reach into private implementation details.