Linux:
# javac -h . org/example/Foo.java
#
# gcc -I$JAVA_HOME/include -I$JAVA_HOME/include/linux -fPIC -o libfoo.so -shared foo.c
#
# tree ./
./
├── foo.c
├── libfoo.so
├── org
│ └── example
│ ├── Foo.class
│ └── Foo.java
└── org_example_Foo.h
2 directories, 5 files
# java -Djava.library.path=. org.example.Foo
Hello, World
展开