JAR 文件中的 Java 小程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2982935/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java Applet in JAR File
提问by Jared Revik
I have created a java applet (.class file) and made a .jar with it and digitally signed the .jar file. Now I need to run the .jar as an applet in firefox. What do I put in the html code to run the .jar file as an applet? I tried and it doesn't work, it tries to get a .class file, how do I load and run my applet as a .jar file using the applet tag in Internet Explorer and Firefox? I searched on the internet and could not find an answer.
我创建了一个 java 小程序(.class 文件)并用它制作了一个 .jar 并对 .jar 文件进行了数字签名。现在我需要在 Firefox 中将 .jar 作为小程序运行。我应该在 html 代码中放入什么来将 .jar 文件作为小程序运行?我试过了,但它不起作用,它试图获取一个 .class 文件,我如何使用 Internet Explorer 和 Firefox 中的小程序标记将我的小程序作为 .jar 文件加载和运行?我在互联网上搜索,找不到答案。
采纳答案by bwawok
http://java.sun.com/docs/books/tutorial/deployment/jar/run.html
http://java.sun.com/docs/books/tutorial/deployment/jar/run.html
should work
应该管用
<applet code=TicTacToe.class
archive="TicTacToe.jar"
width=120 height=120>
</applet>
(The class has your main() I assume, the jar is the entire thing)
(我认为这个类有你的 main(),jar 是整个东西)
回答by jweyrich
What doesn't work? Any errors? Does it show up at least?
什么不起作用?任何错误?它至少出现了吗?
The HTML is as simple as:
HTML 非常简单:
<applet code="class_that_extends_Applet.class" archive="your_signed.jar">
<param name="param1" value="value1">
<param name="param2" value="value2">
</applet>