Article View: borland.public.jbuilder.java.swing
Article #8331Solution: Running Swing in Explorer without plug-in
From: Odd Vinje
Date: Wed, 20 Sep 2000 00:00
Date: Wed, 20 Sep 2000 00:00
87 lines
3847 bytes
3847 bytes
Many of you have posted messages complaining about the lack of support for Swing in Internet Explorer and Netscape. Well, it's not too difficult to get this to work. I'm now running an applet with the latest release of Swing (1.1.1) in Internet Explorer (5.0) without using the plug-in from Sun. You still have to distribute Swing along with your applet, but if you do this carefully you can reduce the size considerably. Here's how: --------------------------------- 1. Extract the class files from swingall.jar. You can do this with WinZip or with the jar tool (which can be downloaded from http://developer.netscape.com/software/signedobj/jarpack.html). 2. For IE, build a cab-file with the cabarc.exe tool from Microsoft SDK for Java (see http://www.microsoft.com/java/sdk/default.htm). For Netscape, build a jar file with signtool.exe (see http://developer.netscape.com/software/signedobj/jarpack.html) Include the class files from your project, and add the extracted class files from swingall.jar. 3. For IE, build a distribution unit cab-file with the dubuild.exe tool from Microsoft SDK for Java. 4. Sign your applet if it's gonna read or write from disk, network, print, or anything else outside the applet sandbox. For IE, use singcode.exe from MS Java SDK. For Netscape use signtool.exe. All your necessary class files are now compressed inside your cab-file (or jar-file). You don't have to distribute anything else. The size of the whole Swing library will add 1.2 MB to your file (compressed). This is considerably less than the 5 MB for the plug-in. But you can reduce it even more if you delete all the class files from Swing that your applet doesn't use. If you need a signed applet, you have to use cab-file for Internet Explorer. It does not support signed jar files. Also, you can't combine a cab- and a jar- (or zip-) file in one html-file for Internet Explorer. If you don't need a singed applet, you can either use a cab- or a jar-file. Netscape does not support cab-files, there you have to use jar-files (unsigned or signed). To build and sign a jar-file, use the Netscape Signing Tool (http://developer.netscape.com/software/signedobj/jarpack.html). The latest release of Swing (1.1.1.) which contains the swingall.jar library can be downloaded from: http://java.sun.com/products/jfc/download.html Your local html-file for Internet Explorer can look like this: <html> <body> <applet code="your.packet.your.class" cabbase="yourcabfile.cab" align="top" width="800" height="600"> </applet> </body> </html> The html file for Internet Explorer for a signed applet on a webserver can look like this: <html> <body> <applet code="your.packet.your.class" useslibrary="Your application name" useslibrarycodebase="yourcabfile.cab" useslibraryversion="1,0,0,0" align="top" width="800" height="600"> </applet> </body> </html> For detailed information on how to build and deploy signed applets, both for Internet Explorer and Nestscape, see http://www.sys- con.com/java/archives/0503/jasnowski/index.html Regards, Odd Vinje
Technical Details
Message-ID:
<In2y5.4523$mq2.72974@news1.online.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,1a1ae1f3ce5ea4d1,start X-Google-Attributes: gid111d45,public From: "Odd Vinje" <odvinje@online.no> Subject: Solution: Running Swing in Explorer without plug-in Date: 2000/09/20 Message-ID: <In2y5.4523$mq2.72974@news1.online.no> X-Deja-AN: 672017614 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 X-Complaints-To: news-abuse@nextra.no X-Trace: news1.online.no 969454184 193.216.64.29 (Wed, 20 Sep 2000 14:49:44 MET DST) Organization: Nextra Public Access X-MSMail-Priority: Normal NNTP-Posting-Date: Wed, 20 Sep 2000 14:49:44 MET DST Newsgroups: borland.public.jbuilder.java.swing