15IT411J Integrative Programming And Technology Laboratory
This section is only for 00-03 titled experiments (JNI related
) in this repository.
To run the program related java native interface follow the following commands for linux on terminal :
javac A.java
javah A
Create a shared library file using the C/C++ file created using terminal.
A
Put lib and then the name for the file written inside the .java file under static block.
Example - JNIDemo.java
static
{
System.loadLibrary("JNIDemo");
}
Then library file’s name should be libJNIDemo.so
B
How to get jdk folder path in linux
If you don’t have jdk1.8.0* then follow these commands if you are using ubuntu or any debian based distro :
sudo apt-get update
sudo apt install default-jdk
Enter password (if you have) and Press Y/y
Go to root directory and search for jdk1.8.0 or a file jni.h
You may get the folder then can copy the path for include folder and linux folder
gcc -fPIC -I"/usr/java/jdk1.8.0_181/include" -I"/usr/java/jdk1.8.0_181/include/linux" --shared -o A.so B.c
java -Djava.library.path=. A
This section will show you how to use these projects (04 - 07)
For 04-jb-non-visual-bean