<p>I was asked to build a java system that will have the ability to load new code (expansions) while running. 
How do I re-load a jar file while my code is running? or how do I load a new jar?</p>

<p>Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if it does not complicate things too much).</p>

<p>What are the things I should look out for?
(think of it as two different questions - one regarding reloading classes at runtime, the other regarding adding new classes).</p>

I googled a bit, and found this code
here
:
```
```
File file = getJarFileToLoadFrom();   
String lcStr = getNameOfClassToLoad();   
URL jarfile = new URL("jar", "","file:" + file.getAbsolutePath()+"!/");    
URLClassLoader cl = URLClassLoader.newInstance(new URL[] {jarfile });   
Class loadedClass = cl.loadClass(lcStr);
```
```
Can anyone share opinions/comments/answers regarding this approach?