Reputation: 3735
My Java FX2 application configures a serial device and as part of deployment, it has to install a Windows device driver and also copy native libs (RxTx serial port libs) over into the Java dirs.
Can Java Web Start handle it? Or should user do it in stages: install driver manually, then copy over libs, then install application via Web Start.
Update: MyApp.jar below is self-signed. I put the dll under the project name. I added this line for the dll in my jnlp. I am using Netbeans 7.3 and so put the VM args line. My jnlp looks like this:
<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>
I can run the app in the Netbeans IDE. However, clicking the jnlp, I get the popup, 'Runtime Error'. It asks me to click for details, but there's nothing shown. I deleted earlier jnlps in the Temporary Internet Files in Java Control Panel. In the Java console I see nothing.
@AndrewThompson I tried Janela to check the jnlp. Useful tool! I see that the dll did not make it into the dist folder. The jnlp is generated by NB 7.3. Is there any way to get it to put in the line for nativelib? I have to do it manually each time. `
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) `
I put the dll into a jar, and added
System.loadLibrary("./rxtxSerial");
That too failed.
Upvotes: 2
Views: 1045
Reputation: 3735
What worked was this
Using a simpler approach (confirmed to work when using NetBeans or Borland JBuilder):
Add RXTXcomm.jar as a library
compile (build) your application
add the rxtxSerial.dll to the root of the distribution folder (projectname/dist when using NetBeans)
from the wiki http://rxtx.qbang.org/wiki/index.php/Deploying_JAVA_with_RXTX
The advice (from Andrew) to put a 'nativelib' directive in the jnlp, did not work.
Upvotes: 0
Reputation: 8332
As far as you remain in the sandbox (unsigned app) you won't access to the local file system. Regarding the device driver installation i suppose a signed app could do it too, but it will probably trigger Windows confirmation.
See http://docs.oracle.com/javase/tutorial/deployment/doingMoreWithRIA/security.html
Upvotes: 0