问题
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.
回答1:
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/
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>
回答2:
A new answer to your edited question. Copied from the internet and updated by me to fit 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.
回答3:
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.
来源:https://stackoverflow.com/questions/7179636/how-to-start-applet-in-eclipse-by-providing-eclipse-with-an-html-file