For a project I need to be able to use some C programs through Java. Our teachers have told us we can use minGW but that only seems to work on Windows, and my machine is running Linux (Mint 18). I saw posts about using javah, but when I attempt to use it, I get the following message
> javah HelloJNI The program 'javah' can be found in the following
> packages: * gcj-4.8-jdk * openjdk-7-jdk * gcj-4.6-jdk *
> openjdk-6-jdk Try: sudo apt-get install <selected package>
So I try sudo apt-get install javah and I get
> sudo apt-get install javah [sudo] password for jess: Reading package
> lists... Done Building dependency tree Reading state
> information... Done E: Unable to locate package javah
What am I doing wrong? can someone give me some pointers on how to do this? Thanks x
javah is a part of JDK (Java Development Kit).
You can get it here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
After installing JDK, you will be able to use javac, javah, and lots more software related to Java development.
If you want to start with sample code, I suggest to go here:
http://jnicookbook.owsiak.org/recipe-No-001/
There, you can find step by step instruction on how to write, compile and run JNI based code. Have fun!