I followed this tutorial http://www.ibm.com/developerworks/java/tutorials/j-jni/section3.html
and I compiled the cpp program using
g++ -o libSample2 -fPIC -shared -I/usr/lib/jvm/java-1.7.0-openjdk-amd64/include -I/usr/lib/jvm/java-1.7.0-openjdk-amd64/include/linux/ Sample2.cpp
I tried to run the ./libSample2 but I got "Segmentation fault (core dumped)"
Any idea?