javassist icon indicating copy to clipboard operation
javassist copied to clipboard

Can not invoke getDeclaredMethod to get private method on CentOS

Open ustraskyline opened this issue 2 years ago • 1 comments

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.

ustraskyline avatar Aug 03 '22 04:08 ustraskyline

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.

prosprice avatar Sep 28 '22 16:09 prosprice