Jau is a smallish library which makes it easy for a Java program to invoke a separate Microsoft Windows application, and communicate with it via its GUI. Jau code typically creates an instance of the application, and then interacts with the application's window. This interaction utilizes the window's GUI controls (e.g. menus, buttons, text fields) and/or shortcut keys. The essential ideas behind Jau are shown in the diagram at the top of this page.
Jau rests on top of two powerful libraries - Java Native Access (JNA) and the AutoItX DLL that forms part of AutoIt. I'll explain the details of the connections between Jau, JNA, and AutoIt in the implementation section.
There are many examples of the 'Jau' style of programming in the download (in the "Test" and "Use" files). For example, you can easily create slides with PowerPoint, convert DOCX files to PDF with MS Word, utilize Firefox to retrieve word definitions, convert a JPG image to PNG format with XnView, play a music clip with Windows Media Player, and start building a 3D scene in SketchUp.
The obvious drawback of these astounding abilities is that the Java code is hardwired to a particular application (e.g. Word, XnView) and to a particular OS (varieties of MS Windows).
A less obvious problem is the inherent "fragility" of this kind of window-based communication. There's a likelihood that such code will break at runtime. For example, communication in a Java-PowerPoint program may be progressing wonderfully, with Java sending text and commands to the PowerPoint window to build a slide. Suddenly the user clicks on another window on the Desktop, causing the OS'es window focus to change. Unfortunately, most Jau programs assume that the focus won't change after the application window has become active. This means that the Java program's text and commands will now be delivered to another window without an alarm being raised.
Even without user intervention problems, the behavior of a GUI, especially when an application first starts, can be hard to handle programmatically. For instance, What should a Jau program do when a "Do you want to update this software?" dialog appears, or an information window pops up? The appearance of these windows will change the OS'es focus, and the Jau program will lose its link to the application window.
The problem of windows appearing at random and so changing the focus isn't limited to the application invoked by Jau. Any other program currently running in the OS can trigger such changes.
Consequently, I wouldn't recommend that Jau be used for mission-critical applications, such as nuclear reactor monitoring, death-ray controllers, or deep-space command systems. If there's a Java API available for an application, then it's much better to use that. However, if you don't mind a string, brown paper, and glue approach to programming, then Jau's for you!