Bug 834232

Summary: Wrong include directive in "jni.h"
Product: [Fedora] Fedora Reporter: Marco Guazzone <marco.guazzone>
Component: java-1.7.0-openjdkAssignee: Deepak Bhole <dbhole>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: dbhole, jvanek, omajid, orion
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-21 16:13:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
A simple C++ that can be used to reproduce this error (see 'Steps to Reproduce') none

Description Marco Guazzone 2012-06-21 09:33:58 UTC
Created attachment 593399 [details]
A simple C++ that can be used to reproduce this error (see 'Steps to Reproduce')

Description of problem:
In file '/usr/lib/jvm/java/include/jni.h' the following include directive
  #include "jni_md.h"
at line 45 is wrong since this file is in the 'linux' subdirectory

Version-Release number of selected component (if applicable):
1.7.0.3-2.2.1.fc17.8.x86_64

How reproducible:
Compile C/C++ a file which include the jni.h header.

Steps to Reproduce:
1.Create a C++ file 'try_java.cpp' with an empty 'main' and with the '#include <jni.h>' directive
2.Compile it (e.g., with gcc):
  g++ -Wall -ansi -pedantic -I/usr/lib/jvm/java/include -o try_java try_java.cpp
3.You should get an error.

Actual results:
You get the following error:
  In file included from try_java.cpp:1::
  /usr/lib/jvm/java/include/jni.h:45:20: fatal error: jni_md.h: No such file or directory

Expected results:
No error.

Additional info:
To fix this problem, I think it should be sufficient to replace in file '/usr/lib/jvm/java/include/jni.h' the line 45:
  #include "jni_md.h"
with
  #include "linux/jni_md.h"

Comment 1 Deepak Bhole 2012-06-21 16:13:51 UTC
Hi. This is intentional. Please see #13:

http://java.sun.com/products/jdk/faq/jni-j2sdk-faq.html#jni_md

Comment 2 Orion Poplawski 2012-12-03 21:36:47 UTC
Hmm, that FAQ link appears to be broken now.  So:

13. My compiler can't find jni_md.h!
Please add <jdk>\include\win32 or <jdk>/include/solaris to the include path of your compiler. Just <jdk>/include is not suffcient.

or <jdk>/include/linux as the case may be.