Primitive types

Java provides 8 “primitives” types: byte, short, int, long, float, double, char, and boolean. These are the same as the following C++ typedefs (which are defined by gcj/cni.h): jbyte, jshort, jint, jlong, jfloat, jdouble, jchar, and jboolean. You should use the C++ typenames (e.g. jint), and not the Java types names (e.g. int), even if they are “the same”. This is because there is no guarantee that the C++ type int is a 32-bit type, but jint is guaranteed to be a 32-bit type.

Java typeC/C++ typenameDescription
bytejbyte8-bit signed integer
shortjshort16-bit signed integer
intjint32-bit signed integer
longjlong64-bit signed integer
floatjfloat32-bit IEEE floating-point number
doublejdouble64-bit IEEE floating-point number
charjchar16-bit Unicode character
booleanjbooleanlogical (Boolean) values
voidvoidno value


This is a macro whose argument should be the name of a primitive type, e.g. byte. The macro expands to a pointer to the Class object corresponding to the primitive type. E.g., JvPrimClass(void) has the same value as the Java expression Void.TYPE (or void.class).