-   Programming (
-   -   Java applet error: "Applet Failed" (

nro 08-28-2004 05:36 PM

Java applet error: "Applet Failed"
First, here is my code:


import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;

public class firstApplet extends java.applet.Applet {
    Font f = new Font("TimesRoman",Font.BOLD,36);
    public void paint(Graphics g) {
        g.drawString("Hello World", 5, 50);

and my HTML file:


  <TITLE>Applet HTML Page</TITLE>

<H3><HR WIDTH="100%">Applet HTML Page<HR WIDTH="100%"></H3>

<APPLET codebase=.. code="firstApplet.class" width=350 height=200></APPLET>

<HR WIDTH="100%"><FONT SIZE=-1><I>Generated by NetBeans IDE</I></FONT>

I have been struggling to get my java applets to load. I eventually got the plugin installed correctly in Konqueror(I used to get a message saying the java plugin wasn't initialized), but now I am not able to load my applets.

I tried a second method to view the applets, I used the "appletviewer" that comes with the java SDK. Here is my out put:

[mike@localhost firstApplet]$ appletviewer firstApplet.html
java.lang.NoClassDefFoundError: firstApplet/firstApplet (wrong name: firstApplet)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(
at sun.applet.AppletClassLoader.findClass(
at java.lang.ClassLoader.loadClass(
at sun.applet.AppletClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at sun.applet.AppletClassLoader.loadCode(
at sun.applet.AppletPanel.createApplet(
at sun.applet.AppletPanel.runLoader(

The appletviewer does appear, but at the bottom it says "Start: applet not initialized".

If you know of a seperate program that can view applets outside a browser's plugins, I would be more than happy to hear about it.

All help is always appreciated :-)


jlliagre 08-28-2004 06:52 PM

appletviewer worked for me with both your applet and html only after I replaced codebase=.. by codebase="."

All times are GMT -5. The time now is 09:40 AM.