Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Browser not running applet

Status
Not open for further replies.

techninut

Technical User
Nov 28, 2001
92
US
hello !
I am new to programming java, and I have been going through my book. One of the tutorials is to write a java applet, I am able to view the applet in the viewer, however when I run it in the browser it does not come in clearly. My book suggests that I may not have the updated Java plugin, but I have downloaded the most recent SDK which is what I wrote the applet in, shouldn't this update my browser plugins? If not does anyone know where I can download updated plugins?

David R. Sergile
 
Hi dsergile:

There are many reasons that may cause your applet doesn't appear in the browser (the classpath, the plugin, etc.).

If your applet uses Swing or other classes that comes with the 1.3 and older versions of JDK, you need the plugin, depending on your browser. Most of the browsers come with a 1.2 JVM, which will not recognize the Swing and other classes. (Swing=JSomething).

No, the SDK doesn't have the plugin for the browsers, you must download it from the java.sun.com page. When you deploy an applet that needs the plugin you can force the plugin download with the following tag in html:

Code:
<OBJECT classid=&quot;clsid:8AD9C840-044E-11D1-B3E9-00805F499D93&quot;
WIDTH = 800 HEIGHT = 500 codebase=&quot;[URL unfurl="true"]http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0&quot;>[/URL]
<PARAM NAME = CODE VALUE = &quot;YourApplet.class&quot; >
<PARAM NAME = CODEBASE VALUE = &quot;.&quot; >
<PARAM NAME = ARCHIVE VALUE = &quot;AnyJarFileYouCanHave.jar, AnyOtherJarFileYouCanHave.jar&quot; >

<PARAM NAME=&quot;type&quot; VALUE=&quot;application/x-java-applet;version=1.3&quot;>
<PARAM NAME=&quot;scriptable&quot; VALUE=&quot;false&quot;>
<COMMENT>
<EMBED type=&quot;application/x-java-applet;version=1.3&quot;  CODE = &quot;YourApplet.class&quot;
CODEBASE = &quot;.&quot; ARCHIVE = &quot;AnyJarFileYouCanHave.jar, AnyOtherJarFileYouCanHave.jar&quot; WIDTH = 800 HEIGHT = 500  scriptable=false pluginspage=&quot;[URL unfurl="true"]http://java.sun.com/products/plugin/1.3/plugin-install.html&quot;><NOEMBED></COMMENT>[/URL]

</NOEMBED></EMBED>
</OBJECT>

This will check if the browser has the plugin and force the download if it doesn't. It looks a litle weird, but it is just an embedded object with the pluginspage specified. The applet parameters appears twice (code, codebase, archive) because there is a script that prints a different applet tag depending on the situation. In the archive parameter you specify the jar files that you may use, you can avoid it if you don't need it.

The main parameter is the pluginspage, in this case:


If you want another plugin version you should modify the tag, there is a program from sun that will make the work for you.

Once you have the plugin installed you can check the plugin console (double click in the cup of coffee that appears in the systray, beside the clock) to see what can be happening if the applet doesn't work.

This will work fine in windows, I had a little trouble in solaris, because the installation script from the sun's page is corrupted.

Feel free to post back if you have any other question.

Hope it helps. Pedro Andrés Solorzano
Pontificia Universidad Javeriana
Bogotá, Colombia, SurAmérica.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top