Reputation: 11
I try from a long time ago to launch Java applets in browser (they are simple games). For a long time it say out-of-date Java version (now have the latest version 8 update 45), even after I install the latest before 2 min. NVM, I hope I fixed it. Now it say a lot of different errors: runtime exception or AccessControlExeption
for ex.
I am running this programs in Eclipse and I tried them, so they work. Maybe I have a problem with HTML code.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<canvas id="canvas-id" ></canvas>
</body>
<applet width="600" height="170" code="theLightRoute.class"></script>
</applet>
</html>
Upvotes: 0
Views: 131
Reputation: 91
First: your HTML code is not valid, remove the </script>
closing tag inside your <applet/>
section. Even if some browsers can accept it, I don't think you can expect to have a valid result with an invalid tag definition.
Second: the <applet/>
tag support can vary regarding the browser (see http://www.w3schools.com/tags/tag_applet.asp). You should try with <object/>
instead (see http://www.w3schools.com/tags/tag_object.asp)
Third: you cannot expect anymore that any modern web browser will support a java applet, whatever the tag you use. Indeed, most of them have dropped or disabled by default the browser-side support of any java applet for security reasons. For example for Chrome 42, the java support is totally dropped: http://www.infoq.com/news/2015/04/chrome-42-npapi. For Firefox or safari it should be enabled manually https://support.mozilla.org/en-US/kb/how-allow-java-trusted-sites).
Actually, there is no good reason to create some java applet anymore, it's a totally deprecated and obsolete technology (https://softwareengineering.stackexchange.com/questions/154537/do-java-applets-have-any-place-on-the-web-today).
Try to learn HTML5 for game programming instead :-) Many courses exist and can help you, and many HTML5 game engine are available (http://html5gameengine.com/). And it is cross-platform, mobile included!
Upvotes: 1