(So continues the JNI saga....)

I currently have this (in C++, this being my native code in C++):

(x is a jstring passed thru the header)

jdouble res;
	if (x=="*")
	{
		res=a*b;
	}
	else if (x=="+")
	{
		res=a+b;
	}
	else if (x=="-")
	{
		res=a-b;
	}
	else if (x=="/")
	{
		res=a/b;
	}
	else
	{
		res=-9999;
	}
	 return res;

but it says that jstring (x) and const char * (the things after the "==" for example the "*") are not compatible: "Error: operand types are incompatible ("jstring" and "const char *")"

Member Avatar

a) Not everything in Java starts with a "J".

b) if (x.equals("*"))...

a) Not everything in Java starts with a "J".

b) if (x.equals("*"))...

This code is in C++, not Java. I believe variable dot something doesnt exist in C++ (AFAIK).

jstring is the same as const char * as stated in jni.h