How to cache a java applet? - java

can anyone explain to me how to cache a java applet, to speed up performance when reloading the same applet on another page or return.

You need to specify parameters within the applet's HTML object or embed tag:
http://download.oracle.com/javase/1.4.2/docs/guide/plugin/developer_guide/applet_caching.html

Does this page answer it?
<OBJECT ....>
<PARAM NAME="archive" VALUE="...">
....
<PARAM NAME="cache_option" VALUE="...">
<PARAM NAME="cache_archive" VALUE="...">
<PARAM NAME="cache_version" VALUE="...">
</OBJECT>
or
<EMBED ....
archive="..."
....
cache_option="..."
cache_archive="..."
cache_version="...">

Related

ClassNotFoundException for applet class with java 8

I am getting ClassNotFoundException for navigate.class when I am trying to run the below code.
The same code was working fine with java 6_45 but when I migrate my project to java 8 (or either java 7) it is not working.
I tried changing the Class name without the .class extension but it did not work.
It will be very helpful if anyone give some idea as how can it be resolved
<object classid="java:Navigate.class" type="application/x-java-applet" height="1000" width="150">
<PARAM name="codebase" value="/code/applets/">
<PARAM name="copyright" value="NetAcross Communications ltd.">
<PARAM name="Gif-AudioSrc" value="this">
<PARAM name="ModuleGif" value="/images/nav.gif">
<OBJECT classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA" width="150" height="1000" align="top" codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0">
<PARAM name="code" value="Navigate.class">
<PARAM name="codebase" value="/code/applets/">
<PARAM name="type" value="application/x-java-applet;jpi-version=1.7">

Embedded Java Applet not displaying

Attempting to embed a Java applet to an existing webpage. Code appears to be correct (at least as far as I understand it). However in FireFox, the applet simply doesn't show and in IE, I get a couple of different messages stating Java content has been restricted. Yes, Java is enabled in both browsers. My research suggests that the problem may be the web browsers simply blocking Java outright, due to the recent security concerns, however I really would like to double the code to make sure nothing is wrong with it.
Am I missing something with my code or is this the browsers refusing to display Java over security concerns?
Any thoughts?
<div id="links">
<!--[if IE]><!-->
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase="http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab"
type="application/x-java-applet"
width="700" height="30">
<param name="code" value="PopMenu.class" />
<!--<![endif]-->
<!--[if !IE]><!-->
<object classid="java:PopMenu.class"
type="application/x-java-applet"
width="700" height="30">
<!--<![endif]-->
<param name=labelpos value="right" />
<param name="src0" value="button0.gif" />
<param name="src1" value="button1.gif" />
<param name="src2" value="button2.gif" />
<param name="src3" value="button3.gif" />
<param name="text0" value="Robert Frost on Wikipedia"/>
<param name="text1" value="Robert Frost at Poets.org"/>
<param name="text2" value="Robert Frost Out Loud"/>
<param name="text3" value="Robert Frost: America's Poet"/>
<param name="href0" value="http://en.wikipedia.org/wiki/Robert_Frost"/>
<param name="href1" value="http://www.poets.org/poet.php/prmPID/192"/>
<param name="href2" value="http://robertfrostoutloud.com"/>
<param name="href3" value="http://www.ketzle.com/frost"/>
</object>
</div>
EDIT
In response to the comments below; this is part of a school assignment and I have no code for the applet to post; only the .class file. It appears that I'm not the only one in class trying to figure out this issue; however the professor's only response is to write the code as the textbook teaches it. I've done that; but I still want to make sure I'm not missing something, hence why I'm asking about here.

Why are security settings blocking this java applet?

So I am trying to have a scrolling ticker like the news has and I found an applet but there are two problems.
1. Security settings are blocking it
2. I don't understand how the codebase works to look at the java source code.
If anyone can point me in the right direction it would be appreciated.
<APPLET NAME="Ticker1"
CODE="Ticker.class"
ARCHIVE="Ticker.jar"
CODEBASE="http://java.barchart.com/ticker"
HEIGHT="40"
WIDTH="450"
>
<PARAM NAME="panels" VALUE="1">
<PARAM NAME="1:symbols" VALUE="'Indices,$NASX:Nasdaq Comp,'Stocks,IBM,GE,EBAY,YHOO:Yahoo!">
<PARAM NAME="1:scroll" VALUE="-1, 50">
<PARAM NAME="1:bgcolor" VALUE="#000000">
<PARAM NAME="1:fgcolor" VALUE="#FFFFFF">
<PARAM NAME="1:pscolor" VALUE="#00CC00">
<PARAM NAME="1:ngcolor" VALUE="#FF3333">
<PARAM NAME="1:hilight" VALUE="#FFFF00">
<PARAM NAME="1:font" VALUE="Arial, Bold, 12">
<PARAM NAME="1:multiline" VALUE="true">
</APPLET>
Here is the webmaster tool http://www.insidestocks.com/ticker.asp

Force applet to load only once

Here's my situation:
I need to keep an applet loaded, and avoid having to reload it each time the user goes to the page where the applet is embedded.
How can i achieve this? Are there any parameters to set my applet to be singleton?
Here are the parameters I'm currently using:
<object id="mockapplet" name="mockapplet"
classid="java:mockClass"
type="application/x-java-applet"
archive="#{myAppletPath}"
height="1"
width="1" codebase=".">
<param name="code" value="mockApplet" />
<param NAME="MAYSCRIPT" VALUE="true" />
<param name="archive" value="#archivePath}" />
<param name="JAVA_CODEBASE" value="." />
<font color="red">Applet error</font>
</object>
in fact i need init() method to be call only once , in my case it is call each time my page reloads.
well, if your applet is Embedded in your page, you reload it each time you reload the page ! if you want to keep parameters, you have to set a cookie.

Applet to Object tags

im trying to get from applet to object so i can resolve z-index issues. The first applet tag works...my conversion to object doesn't. Can anyone point me in the right direction?
From:
<applet name='previewersGraph' codebase="http://www.mydomain.info/sub/" archive="TMApplets.jar" code='info.tm.web.applet.PreviewerStatsGraphApplet' width='446' height='291'>
<param name="background-color" value="#ffffff" />
<param name="border-color" value="#8c8cad" />
To:
<OBJECT id="previewersGraph" name="previewersGraph" classid="clsid:CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA"
width="200" height="200" align="baseline"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_4_2-windows-i586.cab#Version=1,4,2,0">
<PARAM name="code" value="info.tm.web.applet.PreviewerStatsGraphApplet">
<PARAM name="codebase" value="http://www.mydomain.info/sub/">
<PARAM name="type" value="application/x-java-applet;jpi-version=1.4.2">
<PARAM name="archive" value="TMApplets.jar">
<PARAM name="scriptable" value="true">
No Java 2 SDK, Standard Edition v 1.4.2 support for APPLET!!
</OBJECT>
Firefox fails with a classid attribute. The below should work cross browser:-
<p>
<object type="application/x-java-applet"
name="previewersGraph" width="446" height="291">
<param name="codebase" value="http://www.mydomain.info/sub/" />
<param name="code" value="info.tm.web.applet.PreviewerStatsGraphApplet" />
<param name="archive" value="TMApplets.jar" />
<param name="scriptable" value="true" />
<param name="mayscript" value="true" />
<param name="background-color" value="#ffffff" />
<param name="border-color" value="#8c8cad" />
</object>
</p>
In my tests both IE8 and FF5 required the "type" attribute. The mayscript param is only required for Java plugins before 1.6.0.10. The scriptable param is still required according to javadocs 1.6.0.21. In a test with 1.6.0.24 for a signed applet, IE8 called it OK from JS without scriptable being set true.
The HtmlConverter tool in the jdk/bin directory should help you to create the Object tag (at least with an old version of Java).
Now Sun (euh Oracle) recommends the applet tag and even jnlp. Look at the deployJava.js script.
I don't think changing it to object will fixed your problem as the applet will be still be paint above the HTML.
Why you do not use deployment toolkit ? It would save you a lot of trying - see http://rostislav-matl.blogspot.com/2011/10/java-applets-building-with-maven.html for more info.

Categories