• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jni

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I always got the following error message. Does anyone knows the causes of such error messages? Thanks
p28.c: In function `Java_p28_setAPrivate':
p28.c:6: request for member `GetObjectClass' in something not a structure or union
p28.c:7: request for member `GetFieldID' in something not a structure or union
p28.c:8: request for member `SetIntField' in something not a structure or union
Here is my source code
---------------------------------------------------------------
#include "p28.h"
#include <jni.h>
JNIEXPORT void JNICALL Java_p28_setAPrivate(JNIEnv *env, jobject thisObj, jint val)
{
jclass clazz = env->GetObjectClass(thisObj);
jfieldID fid = env->GetFieldID (clazz, "aPrivate","I");
env->SetIntField(thisObj,fid,val);
}
---------------------------------------------------------------
public class p28
{
private int aPrivate=0;
protected int aProtected=0;
public int aPublic=0;
private static int aStaticPrivate=0;
protected static int aStaticProtected=0;
public static int aStaticPublic =0;
public void printAPrivae()
{
System.err.println("A Private = " + aPrivate);
}
public void printAProtected()
{
System.err.println("A Protected = "+ aProtected);
}
public void printAStaticPrivate()
{
System.err.println("A StaticPrivate = "+ aStaticPrivate);
}
public void printAStaticProtected()
{
System.err.println("A StaticProtected = "+aStaticProtected);
}
public native void setAPrivate(int val);
public native void setAStaticPrivate(int val);
}
---------------------------------------------------------------
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yup, assuming you copied/pasted your source code exactly you have no header file jni.h that describes the missing strucutres, try including it!
Rgds, A
 
Sita Yo
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in fact I have included the jni.h, perhaps there is some error due to cut and paste. Still the same errors appear
Regards
 
reply
    Bookmark Topic Watch Topic
  • New Topic