Question

I'm invoking third party code

method.invoke(null, args);

and it has a classloader that loads a class. Is it possible that I can prevent it from loading a specific class? Also There is more than one third part program that I am invoking and I am looking for a broad solution that will just generally prevent the child classloaders from loading a specific class, seeing as how child classloaders delegate to the parent first is this possible?

Was it helpful?

Solution

Ok after some plugging around I figured out a way to do this, javaagent option, this is an example to intercept all incoming class files, which is what I wanted. This is commonly used in things like memory profilers.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top