Title: Can I dynamically load a different version of the same Java library in an RCP e4 app?
Tags: java;rcp;e4
Question: perhaps better asked with more room...
Can a pure RCP e4 application contain multiple versions of the same java library to be dynamically loaded and associated with a model object based on one of its attributes?
Example: The e4 application will use Axis to communicate with numerous endpoints. Each of those endpoints can/will have different versions of Axis. So, the application needs to have a configuration page where the user can dynamically choose the version of Axis required. Then based on that configuration, the required plug-in would be dynamically loaded for use.
Thank you very much for your thoughts and opinions in advance.
Comment: e4 doesn't provide anything special for this and it can be tricky because of the complex OSGi plug-in classloader system. Some discussion of this [here](https://www.eclipse.org/forums/index.php/t/206159/)

Comment: I am a beginner RCP developer and would appreciate your assistance as I navigate the "tricky path". Would it be possible for you to assist me outside of this forum for compensation?


Here is another answer: It is possible to load multiple versions of same library into java application by using multiple class loaders. Take a chambersjustin@example.net. Every version of library could be loaded like:
URLClassLoader classLoader = URLClassLoader.newInstance(new URL[] {new URL(JAR_PATH_VERSION_N)});
Class someClass = classLoader.loadClass(CLASS_QNAME);

Here is another answer: You could implement the different endpoint communications in different plugins. As every plugin has it's own classloader, each of them could use it's own AXIS implementation. You can use the version bounderies in the dependencies of the plugin.xml to specify the exact version used. As long as you don't use two different versions within the same plugin, it should work. We successfully did this once with Apache Commons Lang library.
[edit] This would be statically, not dynamically though [/edit]

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 2, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:06/08/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><rcp><e4>', 'Title': 'Can I dynamically load a different version of the same Java library in an RCP e4 app?', 'ViewCount': 46, 'id': 37713001, 'user_AboutMe': None, 'user_AccountId': 8600764.0, 'user_DisplayName': 'Kurt', 'user_Reputation': 1.0, 'user_Views': 4.0, 'user_id': 6442458.0}}