wood burning stoves 2.0*
The moose likes Certification Results and the fly likes How to Connect  C using (JNI) java native Interface?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Certification Results
Reply locked New topic
Author

How to Connect C using (JNI) java native Interface??

dhana sss
Greenhorn

Joined: Dec 04, 2004
Posts: 16
i want to connect C program to java using java native Interface.
this is my codding:

HelloWorld.java

class HelloWorld {
private native void print();
public static void main(String[] args) {
new HelloWorld().print();
}
static {
System.loadLibrary("HelloWorld");
}
}

Helloworld.c

#include <jni.h>
#include <stdio.h>
#include "HelloWorld.h"

JNIEXPORT void JNICALL
Java_HelloWorld_print(JNIEnv *env, jobject obj)
{
printf("Hello World!\n");
return;
}

HelloWorld.h

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class 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


hai all i need only the JNI.h file . if any one have please send me the link or send me the txt file to my mail ID : dhana_java@yahoo.com

by
dhana
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Please do not crosspost the same question in multiple forums.
This topic is now closed. You can continue the discussion at:
http://www.coderanch.com/t/272606/java/java/include-JNI-java-native-interface


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to Connect C using (JNI) java native Interface??
 
Similar Threads
JNI What is it, and can I use it
JNI problem
JNI Error
how to include JNI.h(java native interface)
Returning String to Java from C via JNI