11.1. What is JSNI?

In the introduction we gave an analogy on using JSNI, saying you should use it in a similar way to how you’d use assembly language in modern program development—that is, it’s not wrong to do so, but most of the time you don’t need to. GWT takes that analogy one step further and uses the Java mechanism for calling native code, called Java Native Interface (JNI),[1] to interact with JavaScript code—it calls this approach JavaScript Native Interface.

1 Java Native Interface documentation if you’re interested (it isn’t necessary to understand JSNI): http://docs.oracle.com/javase/1.5.0/docs/guide/jni/.

Using JSNI you can include JavaScript code in your program, call other pieces of JavaScript, or provide hooks into your program ...

Get GWT in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.