Can a Java program identify if a class has been loaded by some other threads? Say, my program want to know if the StringBuilder class has been used before by some other threads.
If you want to ask why I need to do so. It is some how related to security. I want to know if some known malicous code has been executed in the JVM running my code.
You could ask the system ClassLoader if it loaded a certain class. But if the intruder used another classloader then you still no know nothing so I don't think that is the solution.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Alec Lee
Ranch Hand
Joined: Jan 28, 2004
Posts: 568
posted
0
How do we ask the System Class loader if it has loaded a certain class or not?
That's because this information isn't publicly available. And why would you need it? Simply try loading it; if it already has been loaded it will not load it again.