我已经使用 Java Web Start 部署了一个 Java(FX) 桌面应用程序。更新工作正常,但只有当我手动运行下载的 JNLP 时,它们才不能从安装到桌面和菜单的快捷方式中工作。
这是我的 JNLP:
<?xml version="1.0" encoding="utf-8"?>
<jnlp codebase="http://192.168.1.85/deploy/" spec="1.0" xmlns:jfx="http://javafx.com" href="Companyapp.jnlp">
<information>
<title>Companyapp</title>
<vendor>Media Citizens</vendor>
<description>Companyapp Presentation Desktop</description>
<homepage href="http://192.168.1.85/deploy/"/>
<offline-allowed/>
<shortcut online="false" install="true">
<desktop />
<menu submenu="Companyapp"/>
</shortcut>
<icon kind="shortcut" href="http://192.168.1.85/deploy/icons/32x32.gif" width="32" height="32" />
<icon kind="shortcut" href="http://192.168.1.85/deploy/icons/64x64.gif" width="64" height="64" />
<icon kind="splash" href="http://192.168.1.85/deploy/icons/splash_screen.jpg" width="1024" height="768" />
</information>
<update check="always" policy="always" />
<security>
<all-permissions/>
</security>
<resources>
<jfx:javafx-runtime version="2.2+" href="http://javadl.sun.com/webapps/download/GetFile/javafx-latest/windows-i586/javafx2.jnlp"/>
</resources>
<resources>
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/>
<jar href="http://192.168.1.85/deploy/Companyapp.jar" main="true" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/async-http-client-1.7.8.jar" size="477791" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/commons-codec-1.7.jar" size="259600" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/commons-io-2.4.jar" size="185140" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/commons-lang3-3.1.jar" size="315805" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/commons-logging-1.1.jar" size="52915" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/json-simple-1.1.1.jar" size="23737" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/slf4j-api-1.7.2.jar" size="26083" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/sqlite-jdbc-3.7.15-SNAPSHOT.jar" size="3702257" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/ws-commons-util-1.0.2.jar" size="34407" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/xmlrpc-client-3.1.3.jar" size="58573" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/xmlrpc-common-3.1.3.jar" size="109131" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/zt-zip-1.5.jar" size="33059" download="eager" />
<jar href="http://192.168.1.85/deploy/libs/javaws.jar" size="893738" download="eager" />
</resources>
<jfx:javafx-desc width="0" height="0" main-class="com.mediacitizens.companyapp.presentation.desktop.Main" name="Company App" />
<application-desc main-class="com.mediacitizens.companyapp.presentation.desktop.Main" />
</jnlp>
以防万一,这是我的程序中安装快捷方式的部分:
// install shortcuts
try
{
IntegrationService is = null;
try
{
is = (IntegrationService) ServiceManager.lookup("javax.jnlp.IntegrationService");
}
catch (UnavailableServiceException use)
{
throw new ApplicationError(use.getLocalizedMessage());
}
if (!is.hasDesktopShortcut())
{
if (!is.requestShortcut(true, true, "Companyapp"))
{
throw new ApplicationError("Integration failed.");
}
}
else
{
//initialController.dialog("Shortcuts exist", "Go away!", null);
}
}
catch (ApplicationError e)
{
initialController.dialog("Failed to integrate a shortcut on your computer.\nCause: " + e.getLocalizedMessage(), "I understand", null);
}
更新 1
我删除<offline-allowed />
了,现在它从快捷方式更新,但我无法离线启动应用程序。所以显然我应该能够?它给了我这个错误:
公平地说,我确实尝试在启动时连接到服务器,但这不会导致此错误:它有 2 秒超时,看起来像这样:
try
{
isOffline = !(InetAddress.getByName(Config.domain + "." + Config.serverDomain).isReachable(2000));
}
catch (IOException e)
{
e.printStackTrace();
}
无论如何,我的代码没有在错误中引用,所以我想如果我没有,我根本无法<offline-allowed />
离线运行应用程序?这是真的?如果是的话,这对于使用 JWS 进行部署来说是一个大问题,我可能会完全放弃它......
更新 2
我想我可能会遇到这个问题:http ://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7121086有人知道解决方法吗?
在它说的错误中
获取用作扩展的每个 jnlp 的 rif。意思是混合在一起。在这种情况下有效
所以我应该将 JavaFX 作为 jar 混合到我的 JNLP 中吗?