So, you specify the location of your OpenOffice.org executable. (Also successfully tested for Star Office 8 and Star Office 7). A default value (valid for my environment but not necessarily for yours) is filled in for you. Then you click one of the buttons and the related OpenOffice.org application opens. In the case of Writer and Calc, a "Hello World" text is added to the document, while for Draw, the application simply opens without doing anything extra.
So, how to make this application available via Web Start? First, I went through Evan's very useful tutorial in his blog (here). For the signing of the JAR files, I used Ant scripts (as described here). Then I ended up with a series of signed OpenOffice.org JARs (juh.jar, jurt.jar, ridl.jar and unoil.jar), as well as swing-layout-1.0.jar and the JAR providing the user interface (shown above) and the interaction with OpenOffice.org. Thanks (a lot) to Wouter van Reeven (the OpenOffice.org expert who I met last month at J-Spring in Holland), who handled the OpenOffice.org side of the story, including the implementation of a local bootstrap method, replacing the remote connection method that I had been using until then.
So, all the JARs were signed and ready for action. I couldn't upload them into my blog, because there were too many and they were too large. So I uploaded them onto www.geocities.com. Not perfect, but it does the job. Thanks to NetBeans, I had a great editor for putting together the JNLP file:
I uploaded the JNLP file into this blog. It's nice that I'm able to put my JNLP file in one place while the JARs are in another (very same principle as the NetBeans autoupdate descriptors). But then the fun began! These are the errors that first draw your attention to there being something wrong:
Exception in thread "main" java.lang.UnsatisfiedLinkError: createJNI
at com.sun.star.lib.connections.pipe.PipeConnection.createJNI(Native Method)
I got this error when clicking any of the buttons in the application. It turned out, after a lot of investigation (by Wouter and me) that we needed to provide native libraries, which (as one would assume, given that the libraries are "native") are different per platform. I worked out how to do it for Windows. Just wrap the SDK's unowinreg.dll file in a JAR file and then sign it (using the approach described here). Then I uploaded the signed native library to the same place on www.geocities.com, after adding a reference to it in the "Library" section of the editor, as you can see in the screenshot above. You need to specify an operating system, so I put "Windows" there.
However, neither Wouter nor I know which parts of the OpenOffice.org SDK Linux (and other platforms) distribution need to be provided in a JAR file. That's why this currently only works under Windows. If someone can tell me which native parts of the OpenOffice.org SDK Linux distribution needs to be put in a signed JAR file, I can include support for those other platforms.
But the UnsatisfiedLinkError problem persisted! And that's when I worked out that the folder that contains the executable needs to be on the java.library.path. And, on Windows you can add the folder to the Java library path by putting it on the classpath. That's what I did. Next, you make sure that the Java Console will be shown when you're in Web Start. (Go to Control Panel and click Java, then go to the Advanced panel and click the button for showing the Java Console.) When you click on the button below (remember, currently only functioning for Windows) and you get to the application shown at the start of this blog entry, you will see a Java Console with this content:
The last line in the above screenshot comes from code that I added to the JAR that provides all the functionality and integration with OpenOffice.org. It just prints out the current content of java.library.path. If you do not find the full path to the folder containing the OpenOffice.org (or Star Office) executable, you will get the UnsatisfiedLinkError error when you click any of the buttons in the application. In that case, add the folder to the classpath (in the Environment Variables section for your system).
Now, bearing all of this in mind, click this button:
And what's the point of this application? Well, imagine an application (possibly a Swing application built on the NetBeans Platform) distributed via Web Start... there's a good chance that it might need to integrate with OpenOffice.org, for spreadsheets or diagrams or whatever. The application in this demonstration is very simple, but it could be very extensive. And now it is clear that it can be distributed via Web Start. And because the native libraries are wrapped with the application, you don't need to have the OpenOffice.org SDK installed on your system. Not bad, I think.
Again, if there's anybody out there who knows which native libraries are required by other platforms for integration with OpenOffice.org... please let me know! Also, if you're on Windows, please click the button above and give the demo a try.