Using PROGIDs to Access COM Objects
The com2java-generated Java proxies always access COM objects via their CLSIDs, but a few customers have requested a way to access COM objects via their PROGIDs instead.
The attachment, hostlib.zip, contains a simple VB EXE which, given a PROGID, will return an object reference to the requested object. Place this on your COM server machine and double-click on it to register it (or use "Hostlib /regserver"). Using the com2java tool, generate the proxies for this EXE with the package name "hostlib", and place them into a "hostlib" subdirectory. Compile the generated proxies on the client machine. You can then use the proxies as in the example below (which creates an Excel "Application" object).
hostlib.Host host = new hostlib.Host("localhost");
excel.Application app = new excel.Application(host.objectFromProgID("Excel.Application"));
Here are the contents of the "Host" class in HostLib.exe. As you can see, it is very simple:
Public Function ObjectFromProgID(ByVal progid As String) As Object
Set ObjectFromProgID = CreateObject(progid)