Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

"jni_md.h: No such file or directory"- Error Message while compiling C source code

 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

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

Thanks
 
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also include JAVA_HOME/include/linux (I think this is the one; I'm on Windows where it's called win32).
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you keep the jni_md.h in the win32 folder? Because if you're using them directly in your application path, you shouldn't - jni.h includes which means the same folder as you currently are.
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Did you keep the jni_md.h in the win32 folder? Because if you're using them directly in your application path, you shouldn't - jni.h includes



I tried copying the jni_md.h file to the same folder where jni.h is available. This time its showing the following error messages:



After this there's a long list of errors stating parse error before '*' token
 
Rob Spoor
Sheriff
Posts: 21972
106
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's Try changing that to Cygwin probably doesn't know the __int64. Also check out http://www.graphics-muse.org/wp/?page_id=147
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Regards,
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic