File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to create two(or more) different classloader for loading the same class file twice or more Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to create two(or more) different classloader for loading the same class file twice or more" Watch "How to create two(or more) different classloader for loading the same class file twice or more" New topic
Author

How to create two(or more) different classloader for loading the same class file twice or more

Bhagirathi Mallick
Greenhorn

Joined: Jul 21, 2011
Posts: 26
Let I have a class named as Loading..


After some time I want to modify the content of a method afterModifing() the same class as follows

Hernan Tavella
Ranch Hand

Joined: Apr 28, 2012
Posts: 42
Please use lowercase in the titles.
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7035
    
  16

Bhagirathi,

1. I've edited your subject line to remove the all-caps. Please read the EaseUp (←click) page on this subject.

2. Could you please re-state your question? I still have no idea what you want, or why you would want to load multiple versions of the same class. A bit of background would be useful. (ie, TellTheDetails (←click)).

Winston

Isn't it funny how there's always time and money enough to do it WRONG?
Artlicles by Winston can be found here
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18121
    
    8

So if I understand your actual problem description, you have a class which behaves one way, and then after a while (I assume this has a precise definition) you want it to behave differently.

If that's the case, then having two versions of the class and having them both loaded by separate classloaders is, well, um, let me just say, it isn't the most obvious or straightforward way to achieve that. I would achieve that by providing the class with a flag which controls the decisions to work the "early" way and the "late" way, and then just set the flag when you want to switch over.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to create two(or more) different classloader for loading the same class file twice or more
 
Similar Threads
whats wrong with my code ?
For the Nth Time Java Pass By copy?
Complie time using custom classloader for decryption.
are static members inherited?
What is the Prototype for Main method in java