Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Jupyter notebook for Java

I've used the Jupyter notebook quite a lot for my Python projects, but now I have to work on something in Java. So I was wondering if I could get Jupyter to work with Java?

After some searching I think I understand that you can install different kernels for other languages, with a list of kernels here. But I don't see one for Java there. The reason I think there is a working solution is this notebook, showing of a Java 9 notebook. Does anyone know how to set this up?

I'm on macOS Sierra if it matters.

like image 385
Bendik Avatar asked Dec 01 '16 18:12

Bendik


People also ask

Can I use Jupyter Notebook for Java?

A Jupyter kernel for executing Java code. The kernel executes code via the new JShell tool. Some of the additional commands should be supported as needed via a syntax similar to the ipython magics. The kernel is fully functional.

Can I run Java in Colab?

Since Java is not natively supported by Colab, we need to run the following code to enable Java kernel on Colab. Run the cell bellow (click it and press Shift+Enter), (If training on CPU, skip this step) If you want to use the GPU with MXNet in DJL 0.10. 0, we need CUDA 10.1 or CUDA 10.2.

Is Jupyter good for machine learning?

Jupyter notebooks can illustrate the analysis process step by step by arranging the stuff like code, images, text, output etc. in a step by step manner. It helps a data scientist to document the thought process while developing the analysis process.

What is advantage of Jupyter Notebook?

Advantages of Jupyter NotebookEasy to convert: Jupyter Notebook allows users to convert the notebooks into other formats such as HTML and PDF. It also uses online tools and nbviewer which allows you to render a publicly available notebook in the browser directly.


2 Answers

IJava available at https://github.com/SpencerPark/IJava requires JDK 9. The build process for my iMac (MacOS 10.13.5) worked like a charm and within 10 minutes, I could start programming interactively in Java within Jupyter.

like image 108
Seshadri R Avatar answered Oct 16 '22 17:10

Seshadri R


While doing a similar search, I found an option that may meet your needs:

SciJava Jupyter Kernel https://github.com/scijava/scijava-jupyter-kernel

I have not actually run Java against this kernel yet, but it's documentation claims to support Java among a number of other scripting languages.

It is constructed to run ImageJ ("an open source Java image processing program"): https://imagej.net/Scripting#Supported_languages

Jupyter Kernels List (reference): https://github.com/jupyter/jupyter/wiki/Jupyter-kernels

like image 25
Nate Stone Avatar answered Oct 16 '22 17:10

Nate Stone