Web上Java小程序的可用性 [英] Usability of Java applets on the web

查看:98
本文介绍了Web上Java小程序的可用性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们大学的在线学习项目中,我们使用Java小程序在Ilias学习单元内显示一些交互式内容(例如某些交互式功能图或一些简单的问题/答案系统或其他交互式元素,以及这些元素的任意组合).

For our eLearning project in our university, we are using Java applets to show some interactive stuff (like some interactive function plotting or some simple question/answer system or other interactive elements and any combination on those) inside of Ilias learning units.

我们之所以选择Java,是因为我们想要一个开放的解决方案(当时HTML5尚不可用,而Flash确实是也不是一种选择).

We decided for Java because we wanted an open solution (and HTML5 was not really available at that time and Flash was and is not really an option).

现在,几年后,我真的感到Java并不是真正可用于网络.主要是因为有很多问题,我无法真正解决所有情况.

Now, a few years later, I really got the feeling that Java is not really usable for the web. Mostly because of a lot of problems I haven't really been able to fix for all cases.

所以,我的问题是:Java只是不适合网络使用还是我做错了?您能指出我如何解决这些问题吗?

So, my question: Is Java just not the right thing for the web or am I doing something wrong? Can you point out how I could solve these problems?

我当时遇到的问题:

  • Java小程序需要一段时间才能加载.即使它是一个非常简单的小applet,有时也需要花费一分钟的时间来加载.这是为什么? Java框架真的比Qt或其他框架大很多吗?还是VM这么大?还是VM这么慢?

  • A Java applet take ages to load. Even if it is a very simple small applet, it sometimes takes about a minute to load. Why is that? Is it really that the Java framework is so much bigger than Qt or other frameworks? Or is the VM so big? Or is the VM so slow?

在加载小程序时,浏览器(或至少是Chrome中的选项卡)的esp会变得非常慢,

The browser (or at least the tab in Chrome) gets very slow esp while loading the applet but also afterwards.

Java小程序在每个系统上看起来都不同. UI控件完全不同,并且行为也略有不同.有时是本机外观(或某种外观),有时则完全是自己的东西.另外,字体也大不相同,并且通常支持Unicode字符的不同子集.这对我们来说是一个真正的问题,因为我们在数学符号中经常使用Unicode,并且有很多报告说某些符号对某些人不起作用.同样,由于字体在每个系统上具有不同的大小,我得到报告说该文本是为几个人剪裁的(或者在JLabel中用"..."缩短).我现在通过在JAR中包含一个TTF来解决这个问题.多数情况下有效.有时我还是得到这些"..."即使使用唯一字体也可以报告.

The Java applet looks different on every system. The UI controls are totally different and also behave slightly different. Sometimes it's the native look (or kind of it), sometimes it's completely something own. Also the font is mostly different and often supports a different subset of Unicode characters. This is a real problem for us because we use Unicode a lot for math symbols and we got a lot of reports that some symbols don't work for some people. Also as the font has different size on each system, I got reports that the text is cut out for a few people (or shortened by "..." in a JLabel). I have gotten around this problem now by including a TTF in the JAR. That works mostly. Still sometimes I get these "..." reports even with the unique font.

有时内存使用率非常高(但并非总是如此).

Sometimes the memory usage is incredibly high (but not always).

在加载带有多个小程序的页面时,浏览器崩溃和/或多个小程序无法正确加载的可能性非常高.整个操作系统也会变得非常慢.

When loading a page with multiple applets, the chances become very high that the browser crashes and or multiple applets don't load correctly. Also the whole operating system gets very slow.

有时,Java applet不会在浏览器X中加载,但会在浏览器Y中加载.单击几次重新加载或重新启动浏览器/系统后,该行为可能会切换.例如,似乎在Firefox中加载小程序的可能性较高(也并非总是如此,但多数情况下,至少在单击一次或两次后重新加载),而在Chrome上加载的可能性较小(但如果幸运的话,有时它也可以工作) .视系统而定,可能是效果最佳的不同浏览器.尽管从来没有一款浏览器能完美运行.此行为在我们测试过的所有系统上(不同的Linux发行版,32bit和64bit,Windows XP/Vista/7,Mac OS X).

Sometimes, the Java applet doesn't load in browser X but in browser Y. After clicking a few times on reload or restarting the browser/system, that behavior may switch. For example, it seems that chances are higher that the applet load in Firefox (also not always, but mostly, at least after clicking one or two times on reload) and less likely on Chrome (but if I am lucky it also works sometimes). Depending on the system, it may be different browsers which work best. Though there is never a browser which works perfect. This behavior is on all the systems we have tested (different Linux distributions, both 32bit and 64bit, Windows XP/Vista/7, Mac OS X).

有时,当我切换到另一个选项卡并返回时,小程序保持空白.有时至少要花很长时间才能再次显示.

Sometimes, the applet stays blank when I switched to another tab and return back. Sometimes it at least takes a very long time until it shows up again.

它耗尽了所有CPU.即使我已经关闭了所有与applet的选项卡.我必须退出浏览器才能解决此问题.

It eats up all the CPU. Even after I have closed all tabs with the applets. I have to quit the browser to resolve this.

一些我们遇到这些问题的例子:

Some examples where we have these problems:

  • http://www.matha.rwth-aachen.de/~ilias/jars/Integration/Integration_Geogebra.html
  • http://www.matha.rwth-aachen.de/~ilias/jars/Abbildungen/Abbildungen.html
  • http://www.matha.rwth-aachen.de/~ilias/jars/Trigonometrie/Trigonometrie_Geonext.html
  • http://www.matha.rwth-aachen.de/~ilias/jars/AnalytischeGeometrieundLA/AnalytischeGeometrieundLA.html
  • http://www.matha.rwth-aachen.de/~ilias/jars/ganze%20und%20natuerliche%20Zahlen/ganze%20und%20natuerliche%20Zahlen.html

如果您查看这些示例,那么哪种Java替代解决方案会比较好?我考虑过使用最近的浏览器进行HTML + JavaScript处理(如果我们告诉用户应该使用的浏览器),尽管我认为其中一些示例可能很难实现(或者至少比Java中更难实现).

If you look at these examples, what would be a good alternative solution to Java? I thought about HTML + JavaScript with recent browsers (it is not really a problem if we tell our users that they should use WebKit based browsers or so), although I think that some of these examples might be very hard to implement (or at least harder than in Java).

推荐答案

Java小程序在本世纪初是现代的.如今,只有少数网站使用Java applet,这可能是浏览器支持不理想的原因之一.

Java applets were modern at the beginning of this century. There are only a few sites using Java applets today and this may be one of the reasons why the browser support is not optimal.

根据我在浏览器卡住之前所看到的情况,您的小程序似乎只是在绘制各种图表.

From what I've seen before my browser got stuck, your applets seem to be just drawing various charts.

我建议尝试使用一种专注于绘制图表的现代JavaScript库: http://javascript.open -libraries.com/utilities/chart/20-best-javascript-charting-and-plotting-libraries/

I would suggest trying one of the modern JavaScript libraries which focus on drawing charts: http://javascript.open-libraries.com/utilities/chart/20-best-javascript-charting-and-plotting-libraries/

或者,如果您需要的功能比库所提供的更多,并且您不太在意跨浏览器的兼容性,则可以使用< canvas> HTML5元素和 SVG -除Internet Explorer以外的所有浏览器都对它们提供了不错的支持.

Alternatively, if you need more options than the libraries offer and you do not care much about cross-browser compatibility, you may use the <canvas> HTML5 element and SVG - all browsers except for Internet Explorer have decent support of these.

如果不要求图表是交互式的,则可以使用PHP,Ruby,Python,Java或任何其他方式在服务器上呈现它们,并将它们作为纯图像发送到浏览器.

If you do not require the charts being interactive, you can render them on the server using PHP, Ruby, Python, Java, or whatever and send them as plain images to the browser.

如果您需要表达数学表达式,请考虑 MathML 或可能在计算机上呈现的纯图像通过服务器脚本运行.

If you need to express mathematical expressions, consider MathML or plain images possibly rendered on the fly by a server script.

这篇关于Web上Java小程序的可用性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆