### 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: |
||
|---|---|---|
| .. | ||
| src | ||
| pom.xml | ||
| README.md | ||
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.