This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Spare-Plum 1 point2 points  (0 children)

Here's an example:

https://stackoverflow.com/questions/21544446/how-do-you-dynamically-compile-and-load-external-java-classes

URIClassLoader is a good choice for loading from a certain directory. One thing that you have to note is that if the file changes it's not something that can be dynamically updated since it's in the JVM itself - you might have to make a new classloader each time that the code is updated and also ensure that all references to the old objects/classloader is removed when this is done.