NCT Quick Start Guide |
This guide shows how to use the Native Connector tool (NCT) to create native connector components that enable you to access a C shared library or a C++ shared library from a Java program.
To start the IDE, type runide.sh in a terminal window.
Before you can create Java classes for a shared library, you must create an enhanced version of the library by compiling and linking the library source code using the -xnativeconnect compiler option.
For more information about the -xnativeconnect compiler option, see the CC(1) man page or the cc(1) man page.
Tip - If you use the Makefile wizard to create a makefile for the library, select the enhanced native library option. This option adds -xnativeconnect to the compiler flags list. |
1. If the directory tree that contains the enhanced native library is not mounted in the Filesystems tab of the Explorer, mount it.
See the Accessing a Directory topic in the Solaris Native Languages Support online help for information about mounting directories.
2. In the Filesystems tab in the Explorer, navigate to the directory that contains the library.
3. Right-click the library and choose Create Native Connector from the contextual menu.
4. Complete the steps and click Finish.
The IDE builds the native connector file (.cdf). The source editor is displayed with the native connector file available for editing. See Step 3 for information on how to use the editor to select the Java API.
Tip - When you click Help in the New wizard, the IDE displays help for the current step. |
After you create the native connector file, you must edit the file to define the Java API. When you complete the steps in the New wizard, the wizard opens the file for editing automatically.
1. In the source editor, use one of the following procedures to pick the classes, methods, and members that you want to expose in the Java API (target wrapper API).
2. If the IDE encounters naming conflicts, it displays a Renaming dialog that shows how it named the class, method, or field accessor to resolve the conflict. Click OK to dismiss the dialog.
3. (Optional) To change the name of a method, double-click the method in the Target Wrapper API list and type the new name.
4. To save the changes, press Ctrl-S.
Tip - To make subsequent changes to the Java API, double-click the native connector descriptor file (.cdf) in the Explorer to open it in the source editor. |
1. In the Explorer, right-click the descriptor file (.cdf) and choose Execute from the contextual menu.
A dialog panel appears which shows where the generated files will go and shows the progress of each step in the generation process. System messages appear in an Output window.
2. When the dialog panel shows that the process is done, click OK.
Copyright © 2002, Sun Microsystems, Inc. All rights reserved.