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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

load: class (Name of class) not found 1

Status
Not open for further replies.

asplus

Instructor
Oct 11, 2002
16
I am trying to test an applet with a thread and I get the message indicated in the subject above when I run it on my PC. I have a class file for the java source that matches in name. My html is simply running the applet giving it a with and height for the window. Everything is in the same subdirectory.

I have uploaded my class file to my web site. When I run it with IE, I just get the blank grey area. When I run it with Netscape, I get a blank grey area plus an error message: java.lang.ClassFormat Error Bad major version number.

If you want to check out my website, go to main page. On the top right hand side is the applet space. It should display a scrolling message but nothing happens. This used to work fine until I changed to a new PC with Windows XP and downloaded JDK version 1.4.0.

Here is the code of the applet followed by the html to test locally.

import java.awt.*;

public class PSABanner extends java.applet.Applet implements Runnable {
Thread runner;
int yPos = 220;
int yMove = -4;
Font f = new Font("TimesRoman", Font.BOLD, 12);

public void start() {
if (runner == null) {
runner = new Thread(this);
runner.start();
}
}

public void stop() {
runner = null;
}

public void run() {
Thread thisThread = Thread.currentThread();
while (runner == thisThread) {
yPos += yMove;
if (yPos < 0)
yPos = 220;
repaint();
try {
Thread.sleep(10);
}
catch (InterruptedException e) {
}
}
}

public void paint(Graphics screen) {
// Draw background
screen.setFont(f);
screen.setColor(Color.blue);
screen.drawString(&quot;SUMMER REGISTRATION&quot;, 72, yPos);
screen.drawString(&quot;Saturday, March 9th 2002&quot;, 78, yPos + 20);
screen.drawString(&quot;2:00 P.M. TO 6:00 P.M.&quot;, 87, yPos + 40);
screen.drawString(&quot;and&quot;, 134, yPos + 60);
screen.drawString(&quot;Saturday, March 23rd 2002&quot;, 78, yPos + 80);
screen.drawString(&quot;2:00 P.M. TO 6:00 P.M.&quot;, 87, yPos + 100);
screen.drawString(&quot;Riverdale High School&quot;, 90, yPos +120);
screen.drawString(&quot;5060 Blvd Des Sources, Pierrefonds&quot;, 61, yPos + 140);
screen.drawString(&quot;or BY MAIL&quot;, 107, yPos + 160);
screen.drawString(&quot;Administrator/Registrar&quot;, 82, yPos + 180);
screen.drawString(&quot;4600 Des Cageux&quot;, 94, yPos + 200);
screen.drawString(&quot;Pierrefonds, Québec&quot;, 91, yPos + 220);
screen.drawString(&quot;H9J 3R4&quot;, 118, yPos + 240);
screen.drawString(&quot;REGISTRATION FEES&quot;, 88, yPos + 260);
screen.drawString(&quot;$85.00 per child&quot;, 100, yPos + 280);
screen.drawString(&quot;4th child and more FREE&quot;, 75, yPos + 300);
screen.drawString(&quot;Additional fees for Intercity and Senior&quot;, 48, yPos + 320);
screen.drawString(&quot;NO REFUND&quot;, 101, yPos + 340);
screen.drawString(&quot;COST AFTER APRIL 1st $110&quot;, 65, yPos + 360);
screen.drawString(&quot;FOR MORE INFORMATION&quot;, 66, yPos + 380);
screen.drawString(&quot;INFO-SOCCER 696-2505&quot;, 80, yPos +400);
}
}

HTML:

<applet code=&quot;PSABanner.class&quot; height=200 width=300>
</applet>


Any help would really be appreciated, I am really stucked...
 
I can see your applet running...
This is a problem with the browser's java version. Most browsers came with the JVM 1.1, last versions of netscape came with JVM1.2 and even JVM1.3, but I haven´t see one with JVM1.4. The solution is that if you need to use the j2se1.4 your clients must have installed the java 1.4 plugin, wich they can download from java.sun.com.
If its not easy, compile your applet with a previous version of the JVM. (1.1 if you want to make your site accesible for more users).

hope it helps.
 
I recompiled my applet with JDK 1.3 and everything is OK so far. I just hope that Sun and Microsoft as well as Netscape can provide latest versions of the JVM with their latest browsers. Since I do not need the functionality of 1.4, 1.3 will do for me.

Thank you for your comment, it confirms what I thought.

Bernard Le Jour
AS Plus Informatique Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top