I have done something like that. More specifically, our application is editing word documents stored on the server through Java. The only way I know of is by using a JNI layer. Your JNI layer will of course be in C++, and it can detect whether Word is installed on the system or not.
To get into more details, when you do CoCreateInstance in C++, that call will return an error code if Word is not installed on the system. You don't have to walk through the registry yourself. That call will go to the registry, find where Word is installed and invoke it. The same goes for all COM components that you might want to use.
However, COM is not a easy beast to tame, and I would'nt go into complexities if I didn't have prior experience with Windows and COM programming. Writing multi-threaded applications in COM is very complex, and you have to remember rules regarding which kind of COM objects you can use in which threads. You couple that with the fact that usually JNI layers don't handle threading, and threading is left to the calling Java application, and you will have problems if you leave COM objects lying around in memory. The rule of thumb for novices is don't use COM objects across threads, or if you really want to be safe:- always declare COM pointers as local variables;ie; instantiate at the start of your function, and release when you leave the function. That's not too efficient because every time you instantiate a COM object, the API has to walk through the registry and possibly load apps or libraries. Plus it is so hard to debug, because I don't know any way you can step into a COM function while debugging a Java app. WHen I was doing serious Java to COM programming, I would have both JBuilder and Visual Studio up, and I would make Visual Studio connect to JBuilder. It was a mess. I don't want to get into too many details of COM in a Java related board, so, in a nutshell, either be careful or try to gain expertise in COM
That Java COM bridge sounds interesting though. It might reduce your learning curve, but I am skeptical whether any Java COM bridge can solve the threading issues inherent in COM
Needless to say, your application will not be platform-independent, but I am sure you must have thought about that. I had heard about an open-source project regarding a pure Java implementation of a a
Word file reader. I think it was Jakarta POI
http://jakarta.apache.org/poi/hwpf/projectplan.html But, when I was looking into it, it was'nt too mature. You might want to investigate that
[ March 24, 2005: Message edited by: Jayesh Lalwani ]