If you have the appropriate try/catch blocks setup (h-gen thunks have them automatically generated), you can throw a Java exception using the following C++ code:
IRMIFL::jni_env *env = passed_in_env; throw new(*env) IllegalArgumentException(*env, String::fromCStr(*env, msg));
Note that MFC's new allocation debugging can interfere with this syntax. By default, VC++ 6.0 generated MFC code will contain a line to define new as DEBUG_NEW:
#define new DEBUG_NEWThis will require that you workaround this by undefining new:
#undef new throw new(*env) RuntimeException(*env, String::fromCStr(*env, "Failed to creat tool bar")); #ifdef _DEBUG #define new DEBUG_NEW #endif