Java Applet 以蜗牛般的速度加载
我的 php 网页上有一个 Java Applet 应用程序( achart)...这里的问题是 Java Applet 需要更多时间来加载...我正在考虑用一些类似的技术替换这些小程序,但速度很快...我指望Ajax...我的其他选择是什么...?
I have a Java Applet application ( achart) on my php Webpage ... Problem here is the Java Applet takes more time to load ... I am thinking of replacing these applets with some similar technology but fast ... I am counting on Ajax... what are my other options ... ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
Java 小程序加载缓慢。 耸耸肩这是野兽的本性......
如果您有多个罐子,您应该检查提供给小程序的类路径的顺序。 请注意,每个 jar 仅在需要加载类时“按需”下载。 它会在第一个 jar 中查找,如果找不到在第二个 jar 中查找的类,依此类推...您可以通过确保启动应用程序所需的所有类都在第一个 jar 中来减少启动时间(s) 列出。
另外,如果您尝试加载不在类路径中的类或资源,则它必须在返回之前搜索所有 jar,并点击服务器代码库进行查找。 它可能会大大减少您的启动时间。
在 java 控制面板中打开 applet 跟踪,您应该可以更好地了解如何从 jar 中加载类。
Java applets load slowly. shrug Its the nature of the beast....
If you have multiple jars, you should check the order of the classpath you provide to your applet. Note that each jar is only downloaded "on demand" whenever a class needs to be loaded. It looks in the first jar, if it can't find the class it looks in the second and so on... You can reduce your startup time by ensuring that all of your classes required for starting up the app are in the first jar(s) listed.
Also, if you are attempting to load a class or resource which is not in your classpath, it must search through all the jars before returning AND hit the server codebase to look there. It can potentially greatly reduce your startup time.
Turn on applet tracing in the java control panel and you should get a better idea of how classes are being loaded out of the jars.
如果小程序的 JAR 库下载时间过长,您可以使用 ProGuard 工具 缩小大小。 以下是一些 Java 库的压缩率比较。
If the size of the applet's JAR library takes to long to download, you can shrink the size with the ProGuard tool. Here is a comparison of the compression ratio for some Java libraries.
你打包好你的罐子了吗......
你尝试过Java部署工具包(http://blogs .oracle.com/vaibhav/entry/java_deployment_toolkit_6u10)
使用jdk 1.6.10+......
Have you packed your jars.....
Have you tried Java deployment toolkit (http://blogs.oracle.com/vaibhav/entry/java_deployment_toolkit_6u10)
with jdk 1.6.10+.....
如果您想要简单的图表,请查看:
http://code.google.com/apis/chart/
If its simple charts you want, have a look at:
http://code.google.com/apis/chart/
Yahoo 有一些不错的 Actionscript 3 (flash) 图表组件 http://developer.yahoo .com/flash/astra-flash/charts/
Google 有一项服务可以将图表生成为图像,正如蒂姆已经指出的那样。
或者,您可以尝试加快正在使用的小程序的交付速度 - 检查它们是否有 Expires 标头,这样它们只会偶尔下载一次,而不是每个页面都下载一次(这对第一次查看没有帮助,但是会加快之后的速度)
编辑:如果您只针对特定浏览器,您可以尝试使用 javascript 和 Canvas 元素创建图表,但这绝对不受 Internet Explorer 支持。 https://developer.mozilla.org/en/Canvas_tutorial
Yahoo has some nice charting components for actionscript 3 (flash) http://developer.yahoo.com/flash/astra-flash/charts/
Google has a service that will generate charts as images as Tim already pointed out.
Alternatively you could try to speed up the delivery of the applets that you are using - check if they have an Expires header so they only get downloaded once in a while instead of for every page (this won't help on the first view, but will speed up those after that)
Edit: if you only target specific browsers you could try and create the charts using javascript and the Canvas element, but that is definitely not supported by internet explorer. https://developer.mozilla.org/en/Canvas_tutorial
我知道这个答案有点晚了,但是,可能是你对 java 的效率非常低,或者你的机器很慢,我有一个 java 程序,它有很多代码以及访问 SQLite 数据库,并且它运行得相当慢速度很快,五秒内加载。 如果您的程序中有任何不使用的内容,请删除它,也尝试 jaring 并对其进行签名(不确定最后两件事是否有帮助。)
I know this answer is a bit late but, it could be that you are just being very inefficent with java or your machine is slow, I have a java program that has quite alot of code as well as accessing an SQLite DataBase and it runs quite quickly, loading within five seconds. If you have anything you don't use in your program then remove it, also try jaring and signing it(not sure if last two things would help.)