Run a Java application in a web browser

允我心安 提交于 2019-12-04 00:28:39

问题


I am relatively new to Java and have a Java application consisting of a couple of packages and a number of classes. I want to be able to run this application in a web browser. How do I go about doing this?


回答1:


Java Web Start is a good technology for deploying Java applications over the web. You can start the application from a web page link, although the application runs outside of the web browser frame: Java Web Start Tutorial.

Java applets allow you to embed a Java application in a web page. It has some serious drawbacks for larger applications.

Servlets (and Java Server Pages) are appropriate technologies for server-side generation of web pages (and other web content) but these technologies won't help you to deploy an existing Swing-based Java application, unless you are prepared to replace the user interface.




回答2:


See the section of the Java Tutorial on how to build and deploy applets.




回答3:


The easiest way for you will be to use a servlet. What you need:

  • Apache Tomcat (Or any other Servlet container)
  • Knowledge of what a servlet is (basically a class that extends from servlet, like httpservlet)



回答4:


If you want a really fancy web-browser based application written in java, then you should learn gwt.



来源:https://stackoverflow.com/questions/2261728/run-a-java-application-in-a-web-browser

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