zeppelin/java
eunhwa99 85b75502e9
[ZEPPELIN-6306] Prevent NPE in StaticRepl by fail-fast JavaCompiler check
### What is this PR for?
- ToolProvider.getSystemJavaCompiler() can return null in JRE environments.
- Added a fail-fast null check in StaticRepl to throw a clear exception early.
- Updated unit test to reflect this behavior.

### What type of PR is it?
Bug Fix

### Todos
* [ ] - Task

### What is the Jira issue?
* [ZEPPELIN-6306](https://issues.apache.org/jira/browse/ZEPPELIN-6306)

### How should this be tested?
*  Run the existing unit test `testJDKCompilerAvailability()` to ensure the compiler is available in JDK.
* Run all Zeppelin unit tests to confirm no regressions.
### Screenshots (if appropriate)

### Questions:
* Does the license files need to update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no


Closes #5069 from eunhwa99/ZEPPELIN-6306.

Signed-off-by: ParkGyeongTae <gyeongtae@apache.org>
2025-09-07 17:37:36 +09:00
..
src [ZEPPELIN-6306] Prevent NPE in StaticRepl by fail-fast JavaCompiler check 2025-09-07 17:37:36 +09:00
pom.xml [MINOR] Bump up version to 0.13.0-SNAPSHOT 2025-08-02 22:05:06 +09:00
README.md [ZEPPELIN-3653] - New Java interpreter 2018-08-03 09:15:19 +08:00

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 JavaCompiler is created.

  • When the user runs commands with java, the JavaParser go 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.

  • JavaInterpreterUtils contains useful methods to print out Java collections and leverage Zeppelin's built in visualization.