Skip to content Skip to sidebar Skip to footer

Embedding A Java Applet

I'm trying to get a Java Applet to display on a webpage. The applet runs in Eclipse, but does nothing on the webpage. For reference here is the applet (no, it's not complete): pack

Solution 1:

I discovered what the problem was, and there seems to be a severe lacking of this knowledge out there....

The HTML tag should look like this...

<applet code=NameOfPackage.NameOfApplet archive=NameOfApplet.jar width=300 height=300>

Thanks to all who helped...

Solution 2:

Can the code attributte be a .jar ? Everything in the right directory?

Try something like this:

<appletcode=NameOfApplet.classname=NameOfAppletarchive=NameOfApplet.jarwidth=300height=300><paramname="bgcolor"value="ffffff"><paramname="fontcolor"value="000000">
    Your browser is not Java enabled.
</applet>

Solution 3:

Try adding a Jpanel before you add your button and text box.

JPanelpanel=newJPanel();
    Containercontent= getContentPane();
    content.setLayout(newGridBagLayout()); // Used to center the panel
    content.add(panel);

Solution 4:

Have you installed the pluging for java on yout browser ?

http://www.oracle.com/technetwork/java/index-jsp-141438.html

Solution 5:

If you don't need it on the site, you could wrap it using http://launch4j.sourceforge.net/ and providing a link to download the executable you made. Perhaps wrap it as an exe than modify the java code to submit values to the server. Then, tell the user to reload the page if the server responds that it received the information. Sorry, it is a clumsy workaround- but it might work.

Post a Comment for "Embedding A Java Applet"