JavaThrow

JavaThrow["exception"]
causes an exception of the specified class to be thrown in the Java thread that called the Wolfram Language program in which JavaThrow occurred.

JavaThrow["exception","message"]
specifies an optional detail message for the exception.

JavaThrow[object]
causes the specified Java Exception object to be thrown.

DetailsDetails

  • To use JavaThrow, you first need to load J/Link using Needs["JLink`"].
  • JavaThrow is a specialized function that few programmers will have any use for.
  • It is up to the user to ensure that the exception being created has an appropriate constructor.