<p>If I'm running a signed Java applet. Can I load additional classes from remote sources, in the same domain or maybe even the same host, and run them?</p>

<p>I'd like to do this without changing pages or even stopping the current applet. Of course, the total size of all classes is too large to load them all at once.</p>

<p>Is there a way to do this? And is there a way to do this with signed applets and preserve their "confidence" status?</p>

[{'answer_id': 60574, 'author': 'John Smithers', 'author_id': 1069, 'author_profile': 'https://Stackoverflow.com/users/1069', 'pm_score': 0, 'selected': False, 'text': '<p>Sounds like it should be possible (but I\'ve never done it). Have you already had a look at Remote Method Invocation (<a href="http://java.sun.com/javase/technologies/core/basic/rmi/index.jsp" rel="nofollow noreferrer">RMI</a>)?</p>\n'}, {'answer_id': 60615, 'author': 'jassuncao', 'author_id': 1009, 'author_profile': 'https://Stackoverflow.com/users/1009', 'pm_score': 4, 'selected': True, 'text': '<p>I think classes are lazy loaded in applets. being loaded on demand.</p>\n\n<p>Anyway, if the classes are outside of a jar you can simply use the applet classloader and load them by name. Ex:</p>\n\n<pre><code>ClassLoader loader = this.getClass().getClassLoader();\nClass clazz = loader.loadClass("acme.AppletAddon");\n</code></pre>\n\n<p>If you want to load classes from a jar I think you will need to create a new instance of URLClassLoader with the url(s) of the jar(s).</p>\n\n<pre><code>URL[] urls = new URL[]{new URL("http://localhost:8080/addon.jar")};\nURLClassLoader loader = URLClassLoader.newInstance(urls,this.getClass().getClassLoader());\nClass clazz = loader.loadClass("acme.AppletAddon");\n</code></pre>\n\n<p>By default, applets are forbidden to create new classloaders. But if you sign your applet and include permission to create new classloaders you can do it.</p>\n'}, {'answer_id': 61203, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>Yes, you can open URL connections to the host you ran your applet from. You can either create a classloader with HTTP urls, or download the classes (as jars) to the user's machine and create a classloader with those jars in the classpath. The applet won't stop and you don't need to load another page.</p>\n\n<p>Regarding the second part of your question about confidence, once the user has granted access to your applet it can download anything, yes anything, it wants to the local machine. You can probably inform the user as to what it's doing, if your UI design permits this.</p>\n\n<p>Hope this helps.</p>\n"}]
['https://Stackoverflow.com/questions/60470', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']