我刚刚关注了一个关于运行Java Applet的教程,看来,按照这个文档https://www.java.com/en/download/help/java_blocked.xml,如果我的简单Applet不遵循以下方面,我就无法运行JRE上的Java小程序。
* 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.
我的问题是:为了简单地运行Java Applet,是否需要遵循任何解决方法?
这是我的代码:
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。:我也尝试使用“appletviewer”&#39; Ubuntu上的二进制文件,但没有好处..
提前致谢!
答案 0 :(得分:1)
如果您正在学习,请不要打扰Applet。为什么学习不赞成的东西?查看仍受支持的Java Web Start。或者,如果您真的只是尝试使用常规主要应用程序来学习Java工作,请在命令行启动。