1

我有一个 JavaFX 程序,它可以作为独立的 Jar 顺利运行,但是当我尝试使用 java web start(即使用 JNLP 文件运行它)时,程序会在一段时间后变慢。通过visualVM查看CPU使用率,往往会随着时间逐渐增加。运行 JNLP 时是否需要设置任何参数?

4

2 回答 2

1

这是我解决问题的方法:

为了调试,我有很多 System.out.println(); 在代码中会非常频繁地触发,大约每 50 毫秒。如果从独立 jar 运行,CPU 使用率不会那么高,但是通过 Java web start,CPU 使用率异常高,我猜是因为沙盒模式的开销。无论如何,删除打印显着降低了 CPU 使用率。

于 2013-02-20T15:34:32.047 回答
0

From references here and here seems that on the first startup JavaFX needs to load additional modules and also it may be some "wait to time out" delays related to the Oracle server migration. These modules, however, should normally be cached so it normally ought to start much faster second time. Also, both references deal with the very old version 1.3 - bugs that were present in this old version may be fixed long time ago.

This basically means that JavaFX more for is not well suitable for running some decoration that has no much value for the the user. Most of the people would wait for a serious application to load I think for somewhat the comparable time as they spend to download the standalone installer.

于 2013-02-12T12:28:14.907 回答