My Applet Runs Fine in Applet Launcher, But Now A Browser!!

Discussion in 'Mac Programming' started by bobber205, Dec 11, 2005.

  1. bobber205 macrumors 68020


    Nov 15, 2005
    I'm playing with Objects in an applet. It's going so far pretty smoothly.
    But when I try to run my applet in an actualy browser, a weird error comes up!

    Why is this? I do access a object called NightElf in my code, but I have uploaded NightElf.class to my server...

    I'm mystified about what to do.

    Code is the following.

    // Alex Wait (
    // December 9, 2005
    // Purpose: To Play With Constructors
    import java.awt.*;
    import java.applet.*;
    public class ObjectMaking extends Applet
    public void init()
    System.out.println("Initializing The Applet");
    public void destroy()
    System.out.println("Destroying My Little Applet");
    public void start()
    	NightElf[] elves;
    	elves = new NightElf[5];
    for (int i = 0; i < 4 ; i++)
    	elves[i] = new NightElf("Custom Elf ");
    	elves[4] = new NightElf();
    	System.out.println("Starting Applet!");
    	System.out.println("Made Some Objects");
    } // end of ObjectMaking.class
    class NightElf 
    	private String name;
    	name = "Default Night Elf"; //default name 
    NightElf(String customName)
    	name = customName;
    static void fakePrint(String output)
    public String returnName() 
    	return name;
    } //end of NightElf class

    Thanks for any help.

    You can find the apple here.

Share This Page