Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Class Already Been Loaded

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do we ask the System Class loader if it has loaded a certain class or not?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java system class loader
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but which method(s) should we use? Just can't see any single method for testing this.
 
Rob Spoor
Sheriff
Pie
Posts: 20665
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic