Java applet not running

Probably the most common cause of an applet not running is that your applet code and resources are not located in the correct directory location relative to your web pages applet tag. This can catch you out especially when your running dynamic XHTML code within a framework such as CakePHP.

For example the simplest applet tag would look something like this:

Show Plain Text
HTML code
  1. <applet code="YourApplet.class" width=100 height=140></applet>

This by default informs the browser or JRE that YourApplet.class code is located in the same directory as your web page.

If you want to run code from a different directory to your web page location you will need to use the codebase element, for example:

Show Plain Text
HTML code
  1. <applet codebase="http://example.com/location_dir" code ="YourApplet.class" width=100 height=140>
Filed under: Java  Tags: Applet

0 Responses to “Java applet not running”

Sorry, comments have been closed for this post.