Jupyter at Bryn Mawr College |
|||
Public notebooks: /services/public/dblank / Experiments |
Based on https://github.com/Bachmann1234/java9_kernel
With changes, added MetaKernel and other fixes.
For more help, see: https://java.net/downloads/adoptopenjdk/REPL_Tutorial.pdf
int x = 1;
y
void draw() {
}
int test_variable_name = 1;
Notice that these expressions have return values (Out):
x
1
$1 + 42
"this is a test"
List list = new ArrayList();
list.add(1);
list;
Building the Java9 kernel around MetaKernel gives you access to magics and the shell.
Here are some examples showing access to the shell and other magics:
! ls
%%file World.java
System.out.println("World!");
%include World.java
%load World.java
System.out.println("World!");
%%shell
ls
One very powerful magic is being able to run multiple kernels through a simple interface.
First we start up a cluster (dashboard -> Cluster -> start)
Next, we use the %parallel magic:
%parallel javakernel JavaKernel
Finally, we execute a Java program in parallel, getting back N results (just two in this case):
%%px
42
Also, because JavaKernel is a MetaKernel, from any other MetaKernel instance, we can run Java code:
%kernel javakernel JavaKernel
%kx Math.sqrt(2);
/vars
/methods
/list all
// Comment
class Test {
public static void main() {
System.out.println("Hallooo");
}
}
Test test = new Test();
test.main();
/classes
/methods
/vars
Press TAB after a few letters for command-line completion:
// type t<TAB>
t