I created a HelloWorld.java file then used javap -h to create HelloWorld.h. Included this header file and jni.h in the C source code. I am using Cygwin on Windows XP. I copied the header files in JAVA_HOME\include directory to usr\include directory of the Cygwin installation on Windows. After doing all this when i try to compile using gcc HelloWorld.c i get a huge list of error messages the first one being "" I guess the other messages might be due to this one.
My HelloWorld.c Source:
I tired to google with the error message but could not get much help. Also i am using Cygwin with JDK 1.6 U13
Also include JAVA_HOME/include/linux (I think this is the one; I'm on Windows where it's called win32).
Oh i forgot to mention that- I did copy the header files from the JAVA_HOME\include\win32. I also tried using gcc with -I option specifying both the include fields- JAVA_HOME\include and JAVA_HOME\include\win32. Earlier i used to get jni.h not found but after copying both the directories i get the message jni_md.h not found.
Thanks a lot. I am able to create the object code and then the DLL now.
But there's a different problem now. when i run java HelloWorld (the name of the java class is HelloWorld) the command line cursor keeps blinking but there's no output. It does not execute and keeps waiting for the output. Any hints on this?