Posted By:
Alexander_Krapf
Posted On:
Tuesday, April 10, 2001 10:30 AM
Hi Francois,
you should use the Throw method instead of the ThrowNew method. You will need to construct the exception instance yourself, including the arguments, because there is no tidy convenience method that takes C-Strings as input.
As an alternative, you might want to consider using our JunC++ion product, which, in the body of a native method, allows you to write code like:
{
if( bConditionMet )
throw MyException( 1, 2, "str1", "str2" );
}
JunC++ion is a tool that, among other things, generates C++ proxy classes for Java classes. A generated native method wrapper will translate your throw statement into the appropriate Java exception and throw it into the JVM.
You can find out more about JunC++ion at http://www.codemesh.com.
Good luck,
Alex
DISCLAIMER: I am a principal at Codemesh, Inc.