Steps to compile a Native Code of Java using Netbeans IDE
1. Check for the C and C++ plugin for netbeans in the “Tools” menu item and clicking on “Plugins”
You will see a tab named “Installed plugins” and find required plugin in the list.If plugin is not present then download the same .
2. After installing your plugin you should be able to see a new category of C C++ projects in new project dialog box.
3. In new project dialog box you can select C or C++ dynamic library for new project and follow the steps of the wizard.
4. Now in the header file folder of your new project “include”(not copy) the file generated by using ”javah” using command line.
5. Now you can give implementation to native interface in the sources folder in a new file meant for the purpose.
6. Now build your project to create a dynamic library in your project build folder.
7. You can include this native library in your java code.
Problem:
You cannot make hybrid projects with both java and C\C++ in the same project. You have to make a separate project.
Also you need to set the path of the dynamic library in Java runtime.
Tuesday, July 1, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment