For reasons that I won't go into here, I need to be able to produce
applets that run under the JVMs built into typically used browsers
(e.g., IE 5.x and Netscape 4.7x). Thus, I set up Jython using Sun's JDK
1.1.8 and built class files from a simple Jython module which extends
one of my Java classes (which itself is an extension of Applet).
Despite an error (can't find a class java.util.HashMap -- not surprising
since that is a Java 2 class, but surprising since the reference
apparently comes from Jython), the applet loads and executes properly
in both IE and Netscape.
The problem is the load time. IE does it in 2-3 seconds, which is
acceptable. Netscape 4.75 takes about 35 seconds, which is not
acceptable. Lest you jump on Netscape because of its old (1.15)
browser, the equivalent Java applet takes only about 5 seconds to load
in Netscape. Is Netscape is wasting all that time looking for
java.util.HashMap? Is there a workaround?
For anyone interested, the Jython source is given below:
from pawt import awt, colors
import java
from com.rlgreene.illum import NoRecIllum,DrawArea,Ball,Trajectory
class JyInstVel(NoRecIllum):
def start(self):
global da,showVel,showAcc,timeDelay,nPts,nSkip,x0,v0x,ax
showVel = showAcc = 0
timeDelay = 40
nPts = 100
nSkip = 1
x0 = 0.0
v0x = 1.0
ax = 0.0
da = DrawArea(10,300,0.0,10.0,40,0.0,1.0)
da.visible = 1
self.add(da)
def doGo(self):
b = Ball(x0,0.5,v0x,0.0,ax,0.0)
traj =
Trajectory(da,b,showVel,1.0,showAcc,1.0,nPts+1,nSkip,timeDelay)
traj.run()
|