Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Cannot open include file: 'jni.h': No such file or directory

Posted on 2009-04-01
2
Medium Priority
?
7,265 Views
Last Modified: 2012-05-06
I'm attempting  to walk through a JNI tutorial found here: http://java.sun.com/docs/books/jni/html/start.html#769

Unfortunately when I use Visual Studio and do the statement #include <jni.h> it can't find the file.

The obvious solution was to include the directories where this file is, which I've done as you can see in the attached project properties jpeg.

However, ever time I try to compile it still can't find the file.

So next I tried adding the two directories under VC++ Directories, (as seen in options.jpeg) and still no luck.


#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"
 
 JNIEXPORT void JNICALL 
 Java_HelloWorld_print(JNIEnv *env, jobject obj)
 {
     printf("Hello World!\n");
     return;
 }
 
// and the H File --------------------------------------------
 
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for classHelloWorldJNI_HelloWorld */
 
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     HelloWorld
 * Method:    print
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_HelloWorld_print
  (JNIEnv *, jobject);
 
#ifdef __cplusplus
}
#endif
#endif

Open in new window

projectproperties.JPG
options.JPG
0
Comment
Question by:Messenger569
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 45

Accepted Solution

by:
AndyAinscow earned 2000 total points
ID: 24046931
The second - you have set a path for executables, not for the include (.h) files - combo at top right 'show directories for'.

Give that a try, does it now work OK ?
0
 
LVL 19

Expert Comment

by:alb66
ID: 24047037
You can add the jdk folder in  Configuration Properties | C/C++ | General

jni.JPG
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question