This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

JavaThrow

JavaThrow["exception"]
causes an exception of the specified class to be thrown in the Java thread that called the Mathematica 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.
  • 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.