Machine OS: Windows XP Home
Browser: Microsoft Internet Explorer 6
Java Release: I should be using jdk1.5.0 (course requirement), but
Windows may be pointed to j2re1.4.2_05
Writing the simplest applet, easily viewed using AppletViewer, yields
only a grey box and the message "load: class MyApplet not found".
From what I can tell using Google, half the world's applet coders have
run into this problem. Each "solution" appears different, from
something to do with signatures and "JAR" files, to accessing the
"Java Icon" on my Control Panel (such an icon of which I have none).
If there's a plugin needed, I have no idea what/where/how.
I have jdk1.5.0 in my PATH setting, but when I go to the page
--physci.org/pc/property.jsp?prop=java.version-- I get "1.1.4" in the
box to the right of "java.version". I believe 1.1.4 may have been
loaded onto my machine before 1.5.0 (or possibly after? I was not the
culprit).
Appletviewer will successfully display the applet only when I enter
the name of the html file. When I enter the name of the class file
the dos prompt simply returns without any action visibly performed.
All components -- .java, .class, and .html -- are in the same
subdirectory.
Below are prints of my html and java code, followed by IE6's Java
Console log when browsing the applet's html page.
My frustration cannot be overstated.
Thanks to any who offer assistance.
=================
HTML: (Copied directly from college text
"Java Software Solutions" by Lewis & Loftus)
=================
<! Boxes.html>
<HTML>
<HEAD>
<TITLE>The Boxes Applet</TITLE>
</HEAD>
<BODY>
<center>
<H3>The Boxes Applet:</H3>
<APPLET CODE="Boxes.class" WIDTH=400 HEIGHT=300 >
</APPLET>
<HR>
</center>
</BODY>
</HTML>
=================
JAVA:
(Copied directly from college text
"Java Software Solutions" by Lewis & Loftus)
=================
//********************************************************************
// Boxes.java Author: Lewis/Loftus
//
// Demonstrates the use of conditionals and loops to guide drawing.
//********************************************************************
import java.applet.Applet;
import java.awt.*;
import java.util.Random;
public class Boxes extends Applet
{
//-----------------------------------------------------------------
// Paints boxes of random width and height in a random location.
// Narrow or short boxes are highlighted with a fill color.
//-----------------------------------------------------------------
public void paint(Graphics page)
{
final int NUM_BOXES = 50, THICKNESS = 5, MAX_SIDE = 50;
final int MAX_X = 350, MAX_Y = 250;
int x, y, width, height;
setBackground (Color.black);
Random generator = new Random();
for (int count = 0; count < NUM_BOXES; count++)
{
x = generator.nextInt (MAX_X) + 1;
y = generator.nextInt (MAX_Y) + 1;
width = generator.nextInt (MAX_SIDE) + 1;
height = generator.nextInt (MAX_SIDE) + 1;
if (width <= THICKNESS) // check for narrow box
{
page.setColor (Color.yellow);
page.fillRect (x, y, width, height);
}
else
if (height <= THICKNESS) // check for short box
{
page.setColor (Color.green);
page.fillRect (x, y, width, height);
}
else
{
page.setColor (Color.white);
page.drawRect (x, y, width, height);
}
}
}
}
=================
JAVA CONSOLE LOG:
=================
Error loading class: Boxes
java.lang.NoClassDefFoundError
java.lang.ClassNotFoundException: Boxes
at com/ms/vm/loader/URLClassLoader.loadClass
(URLClassLoader.java)
at com/ms/vm/loader/URLClassLoader.loadClass
(URLClassLoader.java)
at com/ms/applet/AppletPanel.securedClassLoad
(AppletPanel.java)
at com/ms/applet/AppletPanel.processSentEvent
(AppletPanel.java)
at com/ms/applet/AppletPanel.processSentEvent
(AppletPanel.java)
at com/ms/applet/AppletPanel.run (AppletPanel.java)
at java/lang/Thread.run (Thread.java)
Tor Iver Wilhelmsen - 29 Sep 2004 14:30 GMT
> I have jdk1.5.0 in my PATH setting, but when I go to the page
> --physci.org/pc/property.jsp?prop=java.version-- I get "1.1.4" in the
> box to the right of "java.version".
The browser VM is not loaded from the PATH env variable; the version
number you give indicates the MS VM (which reports 1.1.4 as version).
To have IE use the 1.4/1.5 VM, check the relevant box in the advanced
properties in IE. Presumably, 1.5's beta status means it won't try and
"hijack" APPLET for IE like 1.4 does.
Andrew Thompson - 29 Sep 2004 15:03 GMT
>> I have jdk1.5.0 in my PATH setting, but when I go to the page
>> --physci.org/pc/property.jsp?prop=java.version-- I get "1.1.4" in the
[quoted text clipped - 5 lines]
> properties in IE. Presumably, 1.5's beta status means it won't try and
> "hijack" APPLET for IE like 1.4 does.
You also need to use either Sun's HTMLConverter or the
JavaVersionApplet* in your web page, so that your users
with any other pre 1.4(?) Java, or no Java, can be updated.
* <http://www.physci.org/codes/jre.jsp>
HTH

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane