This sample is located in \Samples\Com\Native_com.
Note To use this sample, it is recommended that you have Microsoft® Visual C++® version 5.0 or higher installed.
Description
Using the Sample
Key Project Files
Technologies Demonstrated
This sample demonstrates Java/COM and COM/Java communications. The sample is invoked from Java. The constructor of the class we invoke instantiates a COM-implemented object. Three methods are then exercised.
The first two methods take and return numeric arguments. The third method instantiates a Java-implemented object, and passes the interface pointer back to Java, caching a local copy for its own use later on. The new Java object is then transparently used from both Java and COM. That is, the COM object treats it no differently than any other COM object, and Java treats it as a Java object.
To compile the sample
The executable files that are built from this sample are included; you do not need to build the sample to run it. However, the following information shows how to build the sample yourself.
These are included in the %SDKDIR%\Bin directory.
Nmake
To run the sample
Run Go.bat, which does the following:
Your CLASSPATH environment variable must include the subdirectories.
The output in the console window is as follows:
2 * 5 = 10 inc.Square(10) = 100 invoked from COM: Hello World invoked from Java: Hello World
This class demonstrates the implementation of Java-callable wrappers (JCWs) and COM-callable wrappers (CCWs).
JMain.javaThis class implements the jcNatComImpl interface as a COM-callable wrapper (CCW).
This sample shows how to use: