The Java APIMATLAB provides fairly full integration with the Java Virtual Machine and the Waterloo Java API can readily be called from the MATLAB desktop command line, scripts or functions.
In addition, a small application called GraphExplorer is bundled with Waterloo. This provides a graph viewer together with an interactive console for working with both Java and Groovy (it is a modification of the GroovyConsole that is bundled with the Groovy language).
To run this on Windows (or *nix-based systems with MATLAB R2012a or later) simply type GraphExplorer at the MATLAB prompt.
For further details, see the Java pages.