Embedding JAR file into HTML?

有些话、适合烂在心里 提交于 2019-12-19 04:11:50

问题


I have a Runnable jar file, is there anyway to embed it into html so people dont have to download my game to play?


回答1:


An Applet is what you want...put the following inside your html..

<APPLET ARCHIVE="yourfile.jar" CODE="yourApplet.class" WIDTH=400 HEIGHT=200>
 </APPLET>

Of course for this, your jar file must contain yourApplet.class




回答2:


What you are looking for is Java Web Start. It can (install &) launch Java rich client apps. (e.g. Swing, SWT, AWT) from a link on a web page.

Note that both web-start & converting the app. to an applet mentioned by other people, would effectively download the Jar to the users computer, it's just that it is 'invisible' to them (unless it is 60+ megabytes - in which case the time will be noticed).

As an aside, speaking as someone with extensive experience of both applets and JWS, I strongly recommend to avoid applets for this one. Use JWS. It is easier, and no conversion of the 'main' class is required. Either way, the Jar will end up needing to be digitally signed.



来源:https://stackoverflow.com/questions/9562092/embedding-jar-file-into-html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!