jnotebook
is a modern notebook system for Java
jnotebook
interprets Java JShell files and render them as notebooks.
Computational notebooks allow arguing from evidence by mixing prose with executable code. For a good overview of problems users encounter in traditional notebooks like Jupyter, see I don't like notebooks and Whatβs Wrong with Computational Notebooks? Pain Points, Needs, and Design Opportunities.
jnotebook
tries to address the following problems:
jnotebook
is a notebook library for Java that address these problems by doing less, namely:
jnotebook
interprets JShell files and renders them as notebook.jnotebook
is not required to run JShell files, it does not introduce a dependency if you wish to run the JShell file in production.jnotebook
always evaluates from top to bottom. jnotebook
builds a dependency graph of Java statements and only recomputes the needed changes to keep the feedback loop fast.jnotebook
requires Java 17 or higher.
jnotebook
is distributed in a single portable binary. Download it.
curl -Ls https://get.jnotebook.catheu.tech -o jnotebook
chmod +x jnotebook
Launch it.
./jnotebook server
# or
java -jar jnotebook server
Then go to http://localhost:5002.
By default, the notebook folder is notebooks
. If it does not exist, it will be created with an example notebook.
jnotebook
automatically detects when a .jsh
file in the notebooks
folder is edited
and renders it in the web app.
Once your notebook is ready to be published, render it in a single html file with:
./jnotebook render notebooks/my_notebook.jsh
A my_notebook.html
file will be generated.
See detailed installation instruction for different platforms in the github project.
Coming soon.
When launched within a maven project, jnotebook
automatically injects the project
dependencies in the classpath. If launched in a submodule, only the submodule
dependencies are injected.
Dependencies can be injected manually with the -cp=<CLASSPATH>
parameter.
Enable IntelliSense highlighting and code utilities for JShell .jsh
files:
*.jsh
.Cells are delimited by blank lines
for multi-statements cells, only the last value or method result is returned.
but everything sent to System.out is returned.
html in return values is interpreted. (see custom html for more html manipulation)
while System.out is not interpreted as html.
By default, the java environment imports common classes. The exact list can be found here.
Mistakes happen! jnotebook
tries its best to give helpful error messages.
Error: cannot find symbol symbol: method invalidJava() location: class invalidJava(); ^^^^^^^^^^^^
Exceptions happen too!
Comments are interpreted as markdown.
// #### example title
// my text with [a link](example.com)
Is rendered as
my text with a link
You can also use multiline comments.
Latex is supported inline:
$`a^2+b^2=c^2`$β will render as .
```math a^2+b^2=c^2 ```
Mermaid graphs are supported
using
```mermaid [MERMAID GRAPH CODE] ```
See mermaid documentation for examples.
jnotebook
provides viewers and utils for data, tables, plots, flamegraphs etc.
These utils are packaged in a separate dependency jnotebook-utils
. By default, jnotebook-utils
is in the classpath.
All utils are available as static method in tech.catheu.jnotebook.Nb
.
jnotebook
also supports Vega Lite.
coming soon
Layouts can be composed via rows, columns and grids
You can use the j2html library directly to generate html easily.
Values inheriting j2html.tags.DomContent
are rendered as html.
This makes it easy to create custom viewers
A big title.
All Nb
viewers output are of class j2html.tags.DomContent
. This makes is easy to combine viewers
My awesome analysis
You can profile methods and generate flamegraphs.
This documentation is directly copying some content from the book of Clerk, a notebook system for Clojure.