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


Step 7: Run the Program

Now run the Java application with the Java interpreter. You should see the following output:
Hello World!
If you see an exception like this one:
java.lang.NullPointerException
	at java.lang.Runtime.loadLibrary(Runtime.java)
	at java.lang.System.loadLibrary(System.java)
	at HelloWorld.(HelloWorld.java:5)
	at 
java.lang.UnsatisfiedLinkError displayHelloWorld
	at Main.main(Main.java:3)
then you don't have a library path set up. The library path is a list of directories that the Java runtime system searches when loading libraries. Set your library path now, and make sure that the name of the directory where the hello library lives is in it.

If you see this exception:

java.lang.UnsatisfiedLinkError no hello in LD_LIBRARY_PATH
	at java.lang.Throwable.(Throwable.java)
	at java.lang.Error.(Error.java)
	at java.lang.LinkageError.(LinkageError.java)
	at java.lang.UnsatisfiedLinkError.(UnsatisfiedLinkError.java)
	at java.lang.Runtime.loadLibrary(Runtime.java)
	at java.lang.System.loadLibrary(System.java)
	at HelloWorld.(HelloWorld.java:5)
	at 
java.lang.UnsatisfiedLinkError displayHelloWorld
	at Main.main(Main.java:3)
then you have a library path set in your environment, but the name of the directory where the hello library lives is not in it. Modify your library path, and make sure that the name of the directory where the hello library lives is in it.

Try to run the program again.


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