### What is this PR for? **New Java interpreter** There are several Java libraries that could be used to leverage the Data Visualization & Collaboration features of Zeppelin hence the need of a Java interpreter to run any java code / library with no further dependencies. Dependencies to any java library can be added by the end users in the Java Zeppelin interpreter Dependencies settings section. ### What type of PR is it? * Feature ### Todos * Any feedback from reviewers ### What is the Jira issue? * [ZEPPELIN-3653] ### How should this be tested? Manually * Start the Zeppelin server * Create a new note with the java interpreter binding * Write some java code as per documentation (docs/interpreter/java.md) Unit tests * Run unit tests (JavaInterpreterTest.java and JavaInterpreterUtilsTest.java) ### Screenshots (if appropriate) ### Questions: * Does the licenses files need update? No, the dependency on com.thoughtworks.qdox was already added as part of the Beam Interpreter. * Is there breaking changes for older versions? No. * Does this needs documentation? Yes, it has been added to the PR, see docs/interpreter/java.md. Author: Vincenzo Selvaggio <vselvaggio@hotmail.it> Closes #3092 from selvinsource/java-interpreter and squashes the following commits:c5f96b27d[Vincenzo Selvaggio] Excluding java interpreter from zeppelin-server tests.3f85f1cd3[Vincenzo Selvaggio] Removed redundant java profile as result of rebasing.b68634034[Vincenzo Selvaggio] Updated documentation for Java interpreter to be more explicit on the limitations.ce9401079[Vincenzo Selvaggio] Updated Java Interpreter README and documentation.9e9a859e9[Vincenzo Selvaggio] Stylecheck fixes.706aa0795[Vincenzo Selvaggio] PR reviews changes: -updated interpreter list -direct import of java module and update related README -static logger for Java interpreterd2358f5dc[Vincenzo Selvaggio] Updated documentation for Java interpreter by adding relevant examples.b57f1cfd0[Vincenzo Selvaggio] Added Java Interpreter Utils and tests for them.f542a4f61[Vincenzo Selvaggio] Java Interpreter first version
866 B
Overview
Java interpreter for Apache Zeppelin
Architecture
Current interpreter implementation supports the static REPL. It compiles the code in memory, execute it and redirect the output to Zeppelin.
Technical overview
-
Upon starting an interpreter, an instance of
JavaCompileris created. -
When the user runs commands with java, the
JavaParsergo through the code to get a class that contains the main method. -
Then it replaces the class name with random class name to avoid overriding while compilation. It creates new out & err stream to get the data in new stream instead of the console, to redirect output to Zeppelin.
-
If there is any error during compilation, it can catch and redirect to Zeppelin.
-
JavaInterpreterUtilscontains useful methods to print out Java collections and leverage Zeppelin's built in visualization.