Skip to content Skip to sidebar Skip to footer

Browser Doesn't Show Java Applet

I'm just starting with java applets and found this website that gives a tutorial. I entered all the code but the applet didn't show up in my browser: HelloWorld.java import java.ap

Solution 1:

(Just Note: These things take place in windows and a few in Ubuntu. Just check the following if any of the following applies to your problem)Try the following things: 1st- In HTML file, change the body tag to:

<bodybgcolor = red>

SO that you know your applet is running on the browser if you find a white rectangle of the dimensions you mentioned but the applet is not running as expected because of some problem with the browser/jre.

2nd- Browsers that we use are generally 32 bit browsers. Do check if you have the 32 bit version of java installed in case your browser is a 32 bit-one.

3rd- To check whether your applet is actually created, try running the html file using appletviewer using the terminal.

run the following either in cmd/terminal whichever you use:

appletviewer filename.html

or if you are using eclipse/netbeans, they usually have a appletViewer integrated along with the IDE so they run the appletviewer directly.

Solution 2:

It looks like the problem is that your x and y coordinates in your drawstring method are the same as the height and width of your applet, so the text is not allowed to appear when rendered in a browser.

In your html, change the height and width to (for example) 400 each, and you should see the text.

Solution 3:

I know that this is already answered but I think the better answer is that the tag applet is deprecated and object should be used.

See the original answer here

Post a Comment for "Browser Doesn't Show Java Applet"