将应用程序转换为小程序
我听到并读到很多人都放弃了 Java Applet。我有一个为桌面编写的java应用程序。但是只需几行代码,我就可以将我的应用程序作为 Applet 部署到 Web 上?我看不出他们有什么不好。谁能告诉我为什么简单地将我的应用程序转换为小程序是一个糟糕的部署想法?
I have heard and read a lot of people putting down Java Applets. I have a java a application written for the desktop. But with a few lines of code, I can deploy my application to the web as an Applet? I fail to see what is so bad about them. Can anyone inform me why simply converting my application to an applet is a bad deployment idea?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
通过几行 JNLP,您可以使用 Java Web Start 直接从网站启动基于 (J)Frame 的项目。
“浏览器”。您可能已经意识到,小程序是由浏览器呈现的网页中的访客。浏览器/JRE/applet 交互错误是 applet 开发人员的祸根。每隔一周就有一个新的。避开浏览器,大部分问题一举解决。
我在我的网站上部署了小程序,尽管我通常只在网页可以为小程序带来一些东西时才制作小程序。 EG 有一个使用 JavaScript 配置的属性小程序。
但我的一般建议是,如果可能的话,避免使用小程序。
With a few lines of JNLP, you can launch your (J)Frame based project directly from a web site using Java Web Start.
'Browsers'. As you probably realize, an applet is a guest in a web page that is rendered by a browser. Browser/JRE/applet interaction bugs are the bane of an applet developer. There is a new one every other week. Avoid the browser, and most of the problems are solved in a stroke.
I deploy applets on my site, though I generally only make an applet when the web page can bring something to the applet. E.G. there is a properties applet that is configured using JavaScript.
But my general advice is, avoid applets if at all possible.
我个人并不认为小程序有什么本质上的坏处。
小程序确实具有受限的安全权限,因此您对相关系统的访问权限将减少。不过,如果您通过网络进行部署,我认为这不会是一个大问题。
I personally don't see anything inherently bad about applets.
Applets do have restricted security permissions, so you will have less access to the system in question. If you're deploying over the web, though, I wouldn't expect this to be a big problem.
Java applet 本身并没有什么问题。我们将应用程序部署为 JWS 桌面应用程序和小程序。
然而,Applet 确实有一些缺点。
首先,带有小程序的页面会强制 Java VM 启动(如果它尚未运行);这可能会导致许多系统上的用户出现明显的延迟。 (我认为这可能是小程序的一些负面因素的根源。它们在网页上被(过度)用于导航栏之类的东西,这些东西可以用 DHTML 轻松处理,开销要少得多。
)浏览器往往是一个更加受限的执行环境。除非您使用 JWS,否则您无权访问文件系统、打印和许多其他资源。您无法打开连接,除非返回到小程序所在的服务器。您通常无法轻松调整小程序窗口的大小。可能还有其他问题。
我相信其他人会指出更多的缺点。 :)
There's nothing inherently wrong with Java applets. We have apps deployed as both JWS desktop applications and as applets.
Applets do have a few shortcomings, however.
First, a page with an applet forces the Java VM to start up if it isn't already running; this can cause noticeable lags for users on many systems. (I think this might be a source of some of the negativity for applets. They were being (over)used on web pages for things like navigation bars that can be easily handled with DHTML with much less overhead.)
Secondly, an applet in a browser tends to be a more constrained execution environment. Unless you are using JWS, you don't have access to the file system, printing, and many other resources. You can't open connections except back to the server where the applet came from. You generally can't easily resize the applet window. There are probably other issues as well.
I'm sure others will point out more shortcomings. :)