Need help with IJava?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

721 Stars 140 Forks MIT License 90 Commits 63 Opened issues


A Jupyter kernel for executing Java code.

Services available


Need anything else?

Contributors list

# 50,500
81 commits
# 90,969
1 commit
# 16,205
1 commit
# 406,402
1 commit


badge badge


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. Check out the list of features further down in the README. Any requests for new ones or prioritizing current requests are welcomed in the issues along with bug requests, installation help, or other questions.

If you are interested in building your own kernel that runs on the JVM check out the related project that this kernel is build on, jupyter-jvm-basekernel.


Try Online

Clicking on the badge badge badges at the top (or right here) will spawn a jupyter server running this kernel. The binder base is the ijava-binder project.


Currently the kernel supports

  • Code execution. output
  • Autocompletion (
    in Jupyter notebook). autocompletion
  • Code inspection (
    up to 4 times in Jupyter notebook). code-inspection
  • Colored, friendly, error message displays. compilation-error incomplete-src-error runtime-error
  • Add maven dependencies at runtime (See also and Try the example Binder). maven-pom-dep
  • Display rich output (See also and maven magic). Chart library in the demo photo is XChart with the sample code taken from their README. (Try the example Binder) display-img
  • eval
    function. (See also Note: the signature is
    Object eval(String) throws Exception
    This evaluates the expression (a cell) in the user scope and returns the actual evaluation result instead of a serialized one. eval
  • Configurable evaluation timeout timeout


  1. Java JDK >= 9. Not the JRE. Java 12 is the current release and should be considered if selecting a version but if a java 9, 10, or 11 build is installed, everything should still be working fine.

    1. Ensure that the
      command is in the PATH and is using version 9. For example:
      > java -version
      java version "9"
      Java(TM) SE Runtime Environment (build 9+181)
      Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
    2. Next ensure that
      is in a location where the jdk was installed and not just the jre. Use the
      java --list-modules
      command to do this. The list should contain
    *   On *nix `java --list-modules | grep "jdk.jshell"`
    *   On windows `java --list-modules | findstr "jdk.jshell"`

    Both should output [email protected] followed by your java version.

    If the kernel cannot start with an error along the lines of

    Exception in thread "main" java.lang.NoClassDefFoundError: jdk/jshell/JShellException
    Caused by: java.lang.ClassNotFoundException: jdk.jshell.JShellException
    then double check that
    is referring to the command for the
    and not the
  2. Some jupyter-like environment to use the kernel in.

    A non-exhaustive list of options:

*   [Jupyter](
*   [JupyterLab](
*   [nteract](


After meeting the requirements, the kernel can be installed locally. Any time you wish to remove a kernel you may use

jupyter kernelspec remove java
. If you have installed the kernel to multiple directories, this command may need to be run multiple times as it might only remove 1 installation at a time.

Install pre-built binary

Get the latest release of the software with no compilation needed. See Install from source for building the the latest commit.

Note: if you have an old installation or a debug one from running

gradlew installKernel
it is suggested that it is first removed via
jupyter kernelspec remove java
  1. Download the release from the releases tab. A prepackaged distribution will be in an artifact named

  2. Unzip it into a temporary location. It should have at least the
    folder extracted in there.
  3. Run the installer with the same python command used to install jupyter. The installer is a python script and has the same options as

    jupyter kernelspec install
    but additionally supports configuring some of the kernel properties mentioned further below in the README.
    # Pass the -h option to see the help page
    > python3 -h

    Otherwise a common install command is

    > python3 --sys-prefix

  4. Check that it installed with

    jupyter kernelspec list
    which should contain

Install from source

Get the latest version of the kernel but possibly run into some issues with installing. This is also the route to take if you wish to contribute to the kernel.

  1. Download the project. ```bash

    git clone cd IJava/ ```

  2. Build and install the kernel.

    On *nix

    ./gradlew installKernel

    On windows

    gradlew installKernel

    See all available options for configuring the install path with

    gradlew -q help --task installKernel
    . Pass the
    , or
    options to change the install location. Also use the
    flag (repeatedly) to set (or add) parameter values with the parameter names (not environment variable) specified in the configuration section below. For example
    --param classpath:/my/classpath/root
    to append to the classpath list.


Configuring the kernel can be done via environment variables. These can be set on the system or inside the

. The configuration can be done at install time, which may be repeated as often as desired. The parameters are listed with
python3 -h
as well as below in the list of options. Configuration done via the installer (or
gradlew installKernel --param ...:...
) should use the names in the Parameter name column.

List of options

| Environment variable | Parameter name | Default | Description | |----------------------|----------------|---------|-------------| |

| A space delimited list of command line options that would be passed to the
command when compiling a project. For example
to enable retaining parameter names for reflection. | |
| A duration specifying a timeout (in milliseconds by default) for a single top level statement. If less than
then there is no timeout. If desired a time may be specified with a
may be given following the duration number (ex
). | |
| A file path separator delimited list of classpath entries that should be available to the user code. Important: no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob. | |
| A file path seperator delimited list of
scripts to run on startup. This includes ijava-jshell-init.jshell and ijava-display-init.jshell. Important: no matter what OS, this should use forward slash "/" as the file separator. Also each path may actually be a simple glob. | |
| A block of java code to run when the kernel starts up. This may be something like
import my.utils;
to setup some default imports or even
void sleep(long time) { try {Thread.sleep(time); } catch (InterruptedException e) { throw new RuntimeException(e); }}
to declare a default utility method to use in the notebook. |
Simple glob syntax

Options that support this glob syntax may reference a set of files with a single path-like string. Basic glob queries are supported including:

  • *
    to match 0 or more characters up to the next path boundary
  • ?
    to match a single character
  • A path ending in
    implicitly adds a
    to match all files in the resolved directory

Any relative paths are resolved from the notebook server's working directory. For example the glob

will match all jars is the directory that the
jupyter notebook
command was run.

Note: users on any OS should use

as a path separator.

Changing VM/compiler options

See the List of options section for all of the configuration options.

To change compiler options use the

environment variable (or
parameter during installation) with a string of flags as if running the

The kernel VM parameters must currently be assigned in the

by adding/editing a JSON dictionary at the
key and changing the
list. To find where the kernel is installed run
> jupyter kernelspec list
Available kernels:
  java           .../kernels/java
  python3        .../python35/share/jupyter/kernels/python3

and the

file will be in the given directory.

For example to enable assertions, set a limit on the heap size to

- "argv": [ "java", "-jar", "{connection_file}"],
+ "argv": [ "java", "-ea", "-Xmx128m", "-jar", "{connection_file}"],
  "display_name": "Java",
  "language": "java",
  "interrupt_mode": "message",
  "env": {


This is where the documentation diverges, each environment has it's own way of selecting a kernel. To test from command line with Jupyter's console application run:

jupyter console --kernel=java

Then at the prompt try: ```java In [1]: String helloWorld = "Hello world!"

In [2]: helloWorld Out[2]: "Hello world!" ```

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.