java - Java Web Start 可以安装 Windows 驱动程序,并将 dll 和 jar 复制到 Java 目录中吗?

标签 java javafx-2 java-web-start rxtx

我的 Java FX2 应用程序配置串行设备,作为部署的一部分,它必须安装 Windows 设备驱动程序并将 native 库(RxTx 串行端口库)复制到 Java 目录中。

Java Web Start 可以处理吗?或者用户应该分阶段进行:手动安装驱动程序,然后复制库,然后通过 Web Start 安装应用程序。


更新: 下面的 MyApp.jar 是自签名的。我把dll放在项目名下。我在我的 jnlp 中为 dll 添加了这一行。我使用的是 Netbeans 7.3,因此放置了 VM args 行。 我的 jnlp 看起来像这样:

  <resources>
    <j2se version="1.6+" java-vm-args="-Djava.library.path=. "  href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="MyApp.jar" size="216992" download="eager" />
    <jar href="lib/RXTXcomm.jar" size="66493" download="eager" />
    <nativelib  href="rxtxSerial.dll" size="122880" download="eager" />
  </resources>
<security>
  <all-permissions/>
</security>

我可以在 Netbeans IDE 中运行该应用程序。但是,单击 jnlp,我得到弹出窗口“运行时错误”。它要求我单击以获取详细信息,但没有显示任何内容。 我在 Java 控制面板的临时 Internet 文件中删除了较早的 jnlps。在 Java 控制台中我什么也看不到。

@AndrewThompson 我试过 Janela 检查 jnlp。有用的工具!我看到 dll 没有进入 dist 文件夹。 jnlp 由 NB 7.3 生成。有什么方法可以让它放入 nativelib 行吗?我每次都必须手动完成。 `

JaNeLA Report - version 11.05.17

Report for file:/D:/Profiles/Anil/My%20Documents/NetBeansProjects/MyApp/dist/MyApp.jnlp

Content type application/xml does not equal expected type of application/x-java-jnlp-file cvc-complex-type.2.4.a: Invalid content was found starting with element 'jfx:javafx-runtime'. One of '{java, j2se, jar, nativelib, extension, property, package}' is expected. cvc-complex-type.2.4.a: Invalid content was found starting with element 'jfx:javafx-runtime'. One of '{java, j2se, jar, nativelib, extension, property, package}' is expected. cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected. cvc-complex-type.2.4.a: Invalid content was found starting with element 'security'. One of '{resources, application-desc, applet-desc, component-desc, installer-desc}' is expected. XML encoding not known, but declared as utf-8 Codebase not specified. Defaulting to file:/D:/Profiles/Anil/My%20Documents/NetBeansProjects/MyApp/dist/ The resource download at MyApp.jar can be optimized by removing the (default) value of download='eager'. The resource download at MyApp.jar can be optimized by removing the (default) value of main='false'. It might be possible to optimize the start-up of the app. by specifying download='lazy' for the MyApp.jar resource. Lazy downloads might not work as expected for MyApp.jar unless the download 'part' is specified. Resource 'lib/RXTXcomm.jar' declared as size '66490' but is actually '66512'. The resource download at lib/RXTXcomm.jar can be optimized by removing the (default) value of download='eager'. The resource download at lib/RXTXcomm.jar can be optimized by removing the (default) value of main='false'. It might be possible to optimize the start-up of the app. by specifying download='lazy' for the lib/RXTXcomm.jar resource. Lazy downloads might not work as expected for lib/RXTXcomm.jar unless the download 'part' is specified. Problem fetching resource rxtxSerial.dll. D:\Profiles\Anil\My Documents\NetBeansProjects\MyApp\dist\rxtxSerial.dll (The system cannot find the file specified) `

我把dll放到一个jar里,然后添加 System.loadLibrary("./rxtxSerial"); 那也失败了。

最佳答案

只要您留在沙箱(未签名的应用程序)中,您将无法访问本地文件系统。关于设备驱动程序安装,我想签名的应用程序也可以安装,但它可能会触发 Windows 确认。

参见 http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/security.html

关于java - Java Web Start 可以安装 Windows 驱动程序,并将 dll 和 jar 复制到 Java 目录中吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15258288/

相关文章:

java - JavaFX 中的按钮不会响应

java - 如何使用 javafx 选择和检索带有复选框控件的列

java - 使用 IntelliJ 远程调试 jnlp 应用程序

Java Web Start (JNLP) 相对于 Java Applet 的优势

java - 一页上的 JSF 多个支持 bean

Java 虚函数调用

Java - 不可修改的键集映射

java - 如何在 Javafx 中将图像添加为组合框中的选项

JavaFX 2 和 RCP

java jre 7u45 中断 classloader.getResources()?