microsoft / java-wdb

Windows Developer Box for Java Developers
MIT License
75 stars 1 forks source link

Better COM interop for Java on Windows #12

Open TarasTielkes opened 3 years ago

TarasTielkes commented 3 years ago

Summary

Initiate and support an integration library and toolchain for interacting with existing native components through COM.

Motivation

A plethora of existing native components is available on Windows that expose a COM interface: parts of Windows itself, other Microsoft products, as well as endless third-party applications, components and libraries. While there are a number of integration libraries available for the JVM, most of these have glaring bugs and memory leaks, and are de-facto unmaintained.

The extent of the existing component ecosystem is huge. In many cases, there are no alternative APIs beyond COM.

If would be a great improvement to have a maintained and supported COM integration strategy for Java. Initially though JNI, but also taking advantage of JEP 191/JEP 393 going forward. Many existing Java/COM integration projects are limited to IDispatch support, which comes with a serious performance penalty.

In an ideal world, integrating with existing COM components would be as fluent and easy from Java as it is from .NET.

brunoborges commented 3 years ago

@TarasTielkes this is an interesting topic. Do you have a few use cases, and how these are implemented today with existing solutions?

And what are the pain points of these solutions?

tbee commented 3 years ago

Oh! Indeed! I often had to use big workarounds to control window components from Java. Usually stuff that you would normally do from VBA, like opening a email in outlook and populating it, so the user has a send-to-send email waiting. Doing some stuff in Excel, not bad if you could kick of Java code from there as well. Controlling Adobe Photoshop. Framemaker. Printer control. Basically every COM component could be a Java class. (If Microsoft ever wanted to adopt Java back in the day, this would have been the move. :-) )

MSAccess with Java backing code... (I often use it for allowing my client to have easy reporting and it would be great that they can use domain logic.)