aspose file tools*
The moose likes Applets and the fly likes Applet working with Browser Plug-in Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet working with Browser Plug-in" Watch "Applet working with Browser Plug-in" New topic
Author

Applet working with Browser Plug-in

Fabricio Sanchez
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
Hi there,

I've been googling for information on creating plug-ins for browsers such as Firefox and MSIE, but haven't found much info regarding java...

Can someone tell me if the following is possible or give me a link or a hint on how to start?

1. I would like to create a plug-in that would contain the majority of my extension jar files. As these are quite big, it would make sense for them to be always present on the user's machine (i.e. downloaded once only), and the update architecture of plug-ins would take care of updating any changes to these jar files.

2. I would then like my applet to be run in such a way that it would be using the plug-in jar files as a classpath.

Am I insane? Please let me know,

Thanx

Fab
[ May 25, 2006: Message edited by: Fabricio Sanchez ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
All recent Java Plugin implementations (at least as far back as JDK 1.3) perform jar caching implicitly. Check the Java Plugin control panel for the available settings. So unless a user has this explictly turned off, jar files would be cached anyway, wothout you hvaing to do anything.

Are you seeing occurrences where this does not happen with your applet?


Ping & DNS - my free Android networking tools app
Fabricio Sanchez
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
The caching behaviour is both good and bad.

You are right, caching would mean the user wouldn't be downloading the files unnecessarily.

However caching also means that it would be difficult to control updates. For example if I updated 2 or 3 of the jars on the server (they would still have the same name) would they be downloaded again to the user's machine at that point or would the (out-of-date) cached version be used?


Also suppose that I have 3 applets each of them different and in a different webpage, but each one of those is using the same extension jar files on the server. I would prefer not to have to download the extension jar files 3 times (once for each applet). I'd rather download those extension jars only once and re-use them with the other applets.


Another problem, like you said, is that the behaviour might depend on the user's settings. I would like the same behaviour to accurr across the border, hence the idea of a plug-in. I wouldn't like a user to loose time just because he did not know about his settings, for example.

Thanx,

Fab.

[ May 26, 2006: Message edited by: Fabricio Sanchez ]
[ May 26, 2006: Message edited by: Fabricio Sanchez ]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
...would they be downloaded again to the user's machine at that point or would the (out-of-date) cached version be used?...

That's easy enough to determine.

I would prefer not to have to download the extension jar files 3 times (once for each applet).

Are they actually being downloaded 3 times? I would think that the cache is URL-based, not applet-specific. But again, that's easy to determine.

...because he did not know about his settings...

The default is to cache, so if the user never discovered these settings, all is good.

You could also look into Java Web-Start, which may give you more control over caching. It's definitely simpler than creating a browser plugin, and, let's face it, I don't think many people install browser plugins any more. The relevant ones (Flash, Shockwave, QuickTime, Java, Acrobat) are shipped with the browser, or updated when new versions of the software is installed. Unless you're talking about commercial software, where people actually pay you money to use the applet - that would be different.
Fabricio Sanchez
Ranch Hand

Joined: Mar 11, 2003
Posts: 33
Thank you very much for all your help Ulf.

I will test all those things we talked about to see if I can really control all the aspects of caching and updating jar files.

From what you said it seems that (within the applet and java plug-in framework )I can do all that I set out to do.

Regards,

Fab.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Applet working with Browser Plug-in