Assignment 10

Due: Tuesay, December 6, 2005


Grading(Maximum Score 100):

Points will be taken off for not meeting all requirements. 5 points will be taken off for each class or method that does not have documentation! Documentation is defined as a written description of what the method or class does. This can be as short as a couple words or as long as a paragraph. Documentation MUST be in JavaDoc Format!

Overview:

In this assignment you will develop an application using the Java Native Interface.

Detail:

In this application you will write a Java class with one method implemented in the C programming language. The method will take in an integer and return the square of that integer. The testing implementation will take in an integer from the command line, and print the result of the integer that is returned by the native method. The input and output should occur in Java, however the calculation must be performed in C.

References:

Java Native Interface

Useful Commands(on Strauss):

javah MyClass // Creates the Header file for your C implementation.
cc -G -I /usr/java/include/ -I /usr/java/include/solaris/ -o libMyClass.so MyClass.c // Compiles the Shared Object
java -Djava.library.path=. MyClass // Runs the Java Class and sets the library path to the local directory.

Hand In:

A print out of your code. Print out of the run.