Handling exceptions

Any exception thrown by called technology can be handled in your Java code. All Javonet methods that operate on objects from .NET Framework DLL throw a JavonetException when exceptions occur. You can catch exceptions by catching the JavonetExceptions, and then perform the appropriate exception handling logic.

I code in:
try {
    // Todo: activate Javonet and add reference to .NET library

    // get .NET type
    NType sampleType = Javonet.getType("TestNamespace.TestClass");

    // call static method
    String response = sampleType.invoke("SayHello", 12.34);
} catch (JavonetException jex) {
    // Todo: your exception handling code

    // expected output:
    // com.javonet.api.NException: Static method 'SayHello(Double)' on class 'TestClass'
    // from assembly 'TestClass, Version=, Culture=neutral, PublicKeyToken=null' was not found.
    // Available methods are:
    // System.String SayHello(System.String)
    // Int32 get_MyStaticField()
    // Void set_MyStaticField(Int32)
    // Boolean Equals(System.Object, System.Object)
    // Boolean ReferenceEquals(System.Object, System.Object)

See Live Example!