ParkGyeongTae commented on code in PR #5048: URL: https://github.com/apache/zeppelin/pull/5048#discussion_r2309399456
########## java/src/main/java/org/apache/zeppelin/java/StaticRepl.java: ########## @@ -104,14 +100,16 @@ public static String execute(String generatedClassName, String code) throws Exce System.setOut(newOut); System.setErr(newErr); + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>(); Review Comment: I previously suggested moving `DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();` to the top, but that was my mistake. What I really meant is that we should move `JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();` to the top. The reason is that `ToolProvider.getSystemJavaCompiler()` can return `null` if running with a JRE instead of a JDK. By checking this early, we can fail fast before doing unnecessary work like parsing the code or redirecting `System.out/err`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@zeppelin.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org