The information in this article applies to:
The following error is generated when trying to build a Java project that imports a COM component whose property is declared as type IUnknown:
Undefined name 'stdole2.IUnknown' (J0049)
The problem is that JActiveX generates Java code that treats IUnknown as a user-defined type, rather than as com.ms.com.IUnknown.
The problem has been fixed for the JActiveX.exe version 3549 that ships with the SDK for Java version 3.2 available at:
However, if you are still using a JActiveX prior to SDK3.2, you could still work around the problem using either of the following two ways:
; IUnknown! [{00000000-0000-0000-C000-000000000046}] Use Class=com.ms.com.Iunknown
jactivex /d . /javatlb /t mappings.jnf MyControl.DLL
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.
Here is a sample case that reproduces the problem. In the following example, the COM component is an ActiveX DLL created using Visual Basic 6.0. This DLL implements a property declared to be of type IUnknown. When you run JActiveX or do an AddCOMWrapper from within Visual J++ 6.0, it treats this property IUnknown as a user-defined type rather than as com.ms.com.IUnknown. The problem is that Visual Basic is marking the IUnknown property type as a user-defined type (VT_USERDEFINED) instead of the usual IUnknown (VT_UNKNOWN).
Public Property Get NewEnum() As IUnknown Set NewEnum = Nothing End Property