与 jar 文件相比,诊断和提高 java jnlp 的性能
客户 X 询问如何改进他使用的 Java 进程的启动时间。 问题是,它不是通过 jar 文件运行,而是通过“jnlp”运行(我假设它表明它是一个 java webstart 应用程序)
StartUserWorx.jnlp
有没有办法将其转换为 JAR 文件,然后让用户调用该应用程序本地,并向 JRE 包含一个启动标志以向进程分配更多 RAM?
用户感到有点沮丧,因为同一办公室的其他工作人员在几乎相同的机器上使用相同的应用程序,但他的进程似乎总是需要更长的时间来加载(几分钟而不是几秒钟)。
Customer X has asked for ways to improve the startup time of a Java process he uses. The problem is, it is not run through a jar file, but rather 'jnlp' (which I am assuming indicates it is a java webstart application)
StartUserWorx.jnlp
Is there a way to convert this to a JAR file and then have the user invoke the application locally, and include a startup flag to the JRE to allocate more ram to the process?
The user is getting a bit frustrated, because other workers in the same office use the same application on almost identical machines, and yet his process seems to always take a much longer time to load (a few minutes rather than a few seconds).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
检查用户的网络设置。 根据我的经验,一分钟长的延迟通常是由 DNS 配置错误、路由表错误(当没有收到肯定响应时 DNS 必须超时)或仅仅是不正确的 lmhosts 文件引起的。
Check the network settings of the user. It is my experience that minute long delays often is caused by DNS misconfiguration, bad routing tables (DNS must time out when no positive response is received), or simply an incorrect lmhosts file.
检查慢速计算机上的代理设置。 该用户可能没有正确的代理设置,并且可能会发生大量额外的网络流量/超时?
我们之前就遇到过 webstart 的问题,从本地服务器下载 jar 是通过代理往返于另一边的。
Check the proxy settings on the slow machine. That user might not have correct proxy settings, and a lot of extra network traffic/timeouts could be occurring?
We've had that issue with webstart before, downloading a jar from a local server was round tripping through the proxy to the other coast and back.
如果您使用记事本之类的工具查看 .jnlp 文件的内容,您将看到它用于运行的所有信息。
查找主类(在 application-desc 节点上)。 这是包含 main 方法的 java 类。 有关详细信息,请参阅 http://java.sun.com /javase/technologies/desktop/javawebstart/index.jsp 用于 jnlp 的规范。
从这里,您可以创建一个具有正确类路径的批处理文件来运行应用程序。 但是,您正在放弃使用 jnlp 方法的任何优点。 所以你需要记住这一点。
jnlp 文件中还有一个“资源”部分,它将向您显示它所需的 jar 文件和其他 webstart jnlp 文件。
不过,您应该在实际应用程序之外进行一些检查。 如果这些是相似的机器,那么很可能有些东西是不同的。 需要碎片整理吗? 网络? 也许 java-vm 本身加载时间太长。
if you use something like Notepad to view the contents of the .jnlp file, you'll see all the information it uses to run.
Look for main-class (on the application-desc node). This is the java class containing the main method. For more information you should refer to http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp for the specification of jnlp.
From here you could create a batch file with a proper classpath for running the application. But, you are breaking away any of the advantages of using the jnlp method. So you'll need to keep that in mind.
There is also a section 'resources' in the jnlp file which will show you jar files it requires and other webstart jnlp's.
You should be doing some checks outside of the actual application though. If these are similar machines, then it's very likely something is different. Defrag needed? Network? Maybe the java-vm itself is taking too long to load.