Previous | Next | Trail Map | Integrating Native Methods into Java Programs | Step By Step


Step 6: Create a Shared Library

Remember in Step 1: Write the Java Code you used the following method call to load a shared library named hello into your program at runtime:
System.loadLibrary("hello");
Now you are ready to create the shared library.

In the previous two steps you create two native language files: in Step 4: Create a Stubs File you created a stubs file named HelloWorld.c, and in Step 5: Write the Native Method Implementation you wrote the implementation for the displayHelloWorld() native method and saved it in HelloWorldImp.c. You compile these two files into a library named hello to create it.

Use whatever tools you have to compile the native language code that you created in the previous two steps into a shared library. On Solaris and MacOS, you'll create a shared library, on Windows 95/Nt you'll create a dynamically loadable library (DLL).


Previous | Next | Trail Map | Integrating Native Methods into Java Programs | Step By Step