如何通过向 Eclipse 提供 html 文件来在 Eclipse 中启动小程序?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7179636/
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
How to start applet in eclipse by providing eclipse with an html file?
提问by user755620
I have written java applet programs under eclipse and run them with help of "run configuration" to provide applet parameters. I have also written a few html files containing <applet> </applet> tags. But I couldn't run applet under eclipse by submitting html files. I don't know how to set the run configuration in eclipse to open an html file with applet. I am looking for ideas to run applets under eclipse by providing eclipse with an html file. I would be grateful, if anyone could help me. Thanks in advance.
我已经在eclipse下编写了java小程序程序,并在“运行配置”的帮助下运行它们以提供小程序参数。我还编写了一些包含 <applet> </applet> 标签的 html 文件。但是我无法通过提交html文件在eclipse下运行applet。我不知道如何在eclipse中设置运行配置以使用applet打开一个html文件。我正在寻找通过为 eclipse 提供一个 html 文件来在 eclipse 下运行小程序的想法。如果有人可以帮助我,我将不胜感激。提前致谢。
回答by Farmor
First follow Justins advice. The look at this link for understanding how to pass paramters to an applet thru html. http://www.brainjar.com/java/parameters/
首先遵循贾斯汀的建议。查看此链接以了解如何通过 html 将参数传递给小程序。http://www.brainjar.com/java/parameters/
Snippet from the site.
来自网站的片段。
<applet code="MyApplet.class" width="300" height="100">
<param name="background-color" value="#ffffff">
<param name="foreground-color" value="#000000">
</applet>
回答by Farmor
A new answer to your edited question. Copied from the internet and updated by me to fit Eclipse Indigo:).
对您编辑的问题的新答案。从互联网复制并由我更新以适合 Eclipse Indigo :)。
First you will have to go to preferences in Window/Web Browser and set Eclipse to Use internal Web > browser.
After that you can open the HTML file from the navigator tree using right click/Open With/Web Browser.
首先,您必须转到窗口/Web 浏览器中的首选项并将 Eclipse 设置为使用内部 Web > 浏览器。
之后,您可以使用右键单击/打开方式/Web 浏览器从导航器树中打开 HTML 文件。
回答by Notchos
Does the applet have a .jar file? If so you can put the .jar file and the HTML in the same folder, and then open the HTML file in a browser of your choice. It works for me. It's just a different way to open.
小程序是否有 .jar 文件?如果是这样,您可以将 .jar 文件和 HTML 放在同一文件夹中,然后在您选择的浏览器中打开 HTML 文件。这个对我有用。只是打开方式不同。