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.
(default) 10 queries took 32 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `comments`111112
2DESCRIBE `tags`221
3DESCRIBE `categories`2216
4DESCRIBE `posts_tags`221
5DESCRIBE `categories_posts`221
6SELECT `Post`.`id`, `Post`.`url`, `Post`.`title`, `Post`.`icon`, `Post`.`metadesc`, `Post`.`metakeys`, `Post`.`categories`, `Post`.`tease`, `Post`.`body`, `Post`.`private_body`, `Post`.`created`, `Post`.`modified`, `Post`.`status`, `Post`.`allow_comments`, `Post`.`tags`, `Post`.`hitcount`, `Post`.`hitcount_rss` FROM `posts` AS `Post` WHERE `Post`.`url` = 'java-applet-not-running' LIMIT 1111
7SELECT `Comment`.`id`, `Comment`.`post_id`, `Comment`.`body`, `Comment`.`author`, `Comment`.`url`, `Comment`.`email`, `Comment`.`ip`, `Comment`.`status`, `Comment`.`junk_score`, `Comment`.`created`, `Comment`.`modified` FROM `comments` AS `Comment` WHERE `Comment`.`status` = 2 AND `Comment`.`post_id` = (24) 000
8SELECT `Tag`.`id`, `Tag`.`tag`, `PostsTag`.`post_id`, `PostsTag`.`tag_id` FROM `tags` AS `Tag` JOIN `posts_tags` AS `PostsTag` ON (`PostsTag`.`post_id` = 24 AND `PostsTag`.`tag_id` = `Tag`.`id`) 110
9SELECT `Category`.`id`, `Category`.`category`, `CategoriesPost`.`post_id`, `CategoriesPost`.`category_id` FROM `categories` AS `Category` JOIN `categories_posts` AS `CategoriesPost` ON (`CategoriesPost`.`post_id` = 24 AND `CategoriesPost`.`category_id` = `Category`.`id`) 110
10UPDATE `posts` AS `Post` SET `Post`.`hitcount` = Post.hitcount + 1 WHERE `Post`.`id` = 2410