I'm just following a tutorial about running Java Applets and it seems that, in accordance with this doc https://www.java.com/en/download/help/java_blocked.xml, if my simple Applet does not follows the aspects bellow, I can't run a Java Applets on JRE.
* Unsigned application An application without a certificate (i.e. unsigned apps), or missing application Name and Publisher information are blocked by default. Running this kind of application is potentially unsafe and present higher level of risk. * Self-signed application (Certificate not from trusted authority) An application with self-signed certificate is blocked by default. Applications of this type present the highest level of risk because publisher is not identified and the application may be granted access to personal data on your computer. * Jar file missing Permission Attribute Permissions Attribute verifies that the application requests the permission level that developer specified. If this attribute is not present, it might be possible for an attacker to exploit a user by re-deploying an application that is signed with original certificate and running the application at a different privilege level.
My question is: Is there any workaround to be followed in order to simple run a Java Applet?
Here is my code:
HelloWorldApplet.java
import java.awt.Graphics;
class HelloWorldApplet {
public void paint(Graphics g) {
g.drawString("Hello World!", 5, 25);
}
}
HelloWorldApplet.html
<html>
<head>
<title> Hello! </title>
</head>
<body>
<P> My Java applet says:
<APPLET CODE="HelloWorldApplet.class" WIDTH=150 HEIGHT=25>
</body>
</html>
Obs.: I also tried to use the 'appletviewer' binary on Ubuntu, but no good..
Thanks in advance!
If you are looking to learn do not bother with Applets. Why learn something deprecated? Check out Java Web Start which is still supported. Or, if you are really just trying to learn Java work with regular main applications kicked off at the command line.