C
catherineattriangle
Hi everyone,
I am having some problems generating header files via Java. The actual
case is more complicated, but this example explains my current
stumbling block:
This is the code I'm putting through javah:
public class Demonstration
{
public String publicName;
private String privateName;
public static String publicStaticName;
private static String privateStatucName;
public native void method1();
public native int method2(boolean b, byte by, char c, short s);
public native byte[] method3(byte data[], boolean b[]);
public native String[] method4(int num, long l, float f, double d);
static
{
System.loadLibrary("Demonstration");
}
}
This is the .h file that results:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Demonstration */
#ifndef _Included_Demonstration
#define _Included_Demonstration
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: publicStaticName */
/* Inaccessible static: privateStatucName */
/*
* Class: Demonstration
* Method: method1
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Demonstration_method1
(JNIEnv *, jobject);
/*
* Class: Demonstration
* Method: method2
* Signature: (ZBCS)I
*/
JNIEXPORT jint JNICALL Java_Demonstration_method2
(JNIEnv *, jobject, jboolean, jbyte, jchar, jshort);
/*
* Class: Demonstration
* Method: method3
* Signature: ([B[Z)[B
*/
JNIEXPORT jbyteArray JNICALL Java_Demonstration_method3
(JNIEnv *, jobject, jbyteArray, jbooleanArray);
/*
* Class: Demonstration
* Method: method4
* Signature: (IJFD)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_Demonstration_method4
(JNIEnv *, jobject, jint, jlong, jfloat, jdouble);
#ifdef __cplusplus
}
#endif
#endif
Whatever happened to public String publicName and private String
privateName? I'm at my wits' end from trying to figure this out. If
this helps, I am using NetBeans IDE 4.1 and using the default Ant XML
file with this added:
<target name="-post-compile">
<javah destdir="headers" classpath="build\classes\"
verbose="yes">
<class name="Demonstration"/>
</javah>
</target>
If anyone could help, that would be great.
Catherine
I am having some problems generating header files via Java. The actual
case is more complicated, but this example explains my current
stumbling block:
This is the code I'm putting through javah:
public class Demonstration
{
public String publicName;
private String privateName;
public static String publicStaticName;
private static String privateStatucName;
public native void method1();
public native int method2(boolean b, byte by, char c, short s);
public native byte[] method3(byte data[], boolean b[]);
public native String[] method4(int num, long l, float f, double d);
static
{
System.loadLibrary("Demonstration");
}
}
This is the .h file that results:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Demonstration */
#ifndef _Included_Demonstration
#define _Included_Demonstration
#ifdef __cplusplus
extern "C" {
#endif
/* Inaccessible static: publicStaticName */
/* Inaccessible static: privateStatucName */
/*
* Class: Demonstration
* Method: method1
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Demonstration_method1
(JNIEnv *, jobject);
/*
* Class: Demonstration
* Method: method2
* Signature: (ZBCS)I
*/
JNIEXPORT jint JNICALL Java_Demonstration_method2
(JNIEnv *, jobject, jboolean, jbyte, jchar, jshort);
/*
* Class: Demonstration
* Method: method3
* Signature: ([B[Z)[B
*/
JNIEXPORT jbyteArray JNICALL Java_Demonstration_method3
(JNIEnv *, jobject, jbyteArray, jbooleanArray);
/*
* Class: Demonstration
* Method: method4
* Signature: (IJFD)[Ljava/lang/String;
*/
JNIEXPORT jobjectArray JNICALL Java_Demonstration_method4
(JNIEnv *, jobject, jint, jlong, jfloat, jdouble);
#ifdef __cplusplus
}
#endif
#endif
Whatever happened to public String publicName and private String
privateName? I'm at my wits' end from trying to figure this out. If
this helps, I am using NetBeans IDE 4.1 and using the default Ant XML
file with this added:
<target name="-post-compile">
<javah destdir="headers" classpath="build\classes\"
verbose="yes">
<class name="Demonstration"/>
</javah>
</target>
If anyone could help, that would be great.
Catherine