4

OK so I'm a complete newby when it comes to Java applets so forgive my lack of knowledge. Is it possible to run multiple codebase locations in the same applet? Basically I have an applet up and running which sources it's class files from an external domain for which I am paying a subscription to but I also wanted to add in my own features by creating my own class files.

The problem is one set of class files will be on a domain that I have no editable access to and my class document I have created will be stored on my own domain.

Is this something that can be done? or will an applet only access java files from one codebase location?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 1) *"Thanks, Louise"* Leave sigs. out of questions. That was 4 lines of noise. 2) An applet has only one codebase, but I had wondered (but never tried) whether it was possible to load a **Jar** (not loose class files) in a different domain using an explicit URL. That would be done in the `archive` attribute. 3) But I am beginning to doubt it is. Sun/Oracle have been becoming gradually more strict with the loading of classes, allowing less and less. – Andrew Thompson Feb 21 '13 at 17:37
  • You can definitely load multiple JAR files. http://stackoverflow.com/questions/2829388/how-do-i-package-up-an-applet-with-multiple-jar-libraries – Philip Whitehouse Feb 21 '13 at 20:21
  • @PhilipWhitehouse The 'multiple Jars' mentioned in that Q&A were coming from the same (single) code base. – Andrew Thompson Feb 22 '13 at 02:38
  • Thanks for both your replies. I think what I'm going to try is the multiple location jars in the archive attribute that @AndrewThompson suggested. I'll let you know if its worked. – Louise Schofield Feb 22 '13 at 09:02
  • Good show! I will add a notify to @PhilipWhitehouse as you can only notify one person in comment. – Andrew Thompson Feb 22 '13 at 09:09
  • OK so after a lot of time spent trying to use multiple located JARs' i think the conclusion for me is this can't be done. From what I have found everything needs to be in the same directory in order for the applet to access it or else it gets very confused! Hopefully in the future Oracle will introduce a way to overcome this but I doubt it as its seems to not be a major problem. For me the solution is having a go at coding the whole applet by myself rather than using this subscription I have. Thanks again for both of your advice. – Louise Schofield Feb 23 '13 at 13:10
  • I have never used JAVA RMI but the documentation says you can execute remote methods. It may help you somehow. Cheers, – Rafa Jul 29 '13 at 01:49

1 Answers1

0

Yes - you may specify multiple JAR-files in your applet-tag:

<applet codebase ="." code="myMainClass.class" archive="archive1.jar,archive2.jar,archive3.jar" height="640" width="480"/>

Please find the detailed Information here

http://docs.oracle.com/javase/1.4.2/docs/guide/misc/applet.html

ARCHIVE = archiveList The archives in archiveList are separated by ",".

Hope this helps! :-)

Greetings

Christopher

Christopher Stock
  • 1,399
  • 15
  • 18