DynamicJava is a REPL for Java code.
DynamicJava includes a built-in IPython kernel. The kernel enables execution of Java code in the IPython terminal application as well as in its web based notebook interface.
-
Install IPython. It can be installed using
pipwithpip install ipythonor through your package manager. -
Create a new IPython profile for DynamicJava. Run
ipython profile create dynamicjava. This will create a new IPython profile in.ipython/profile_dynamicjava. -
Configure the new profile to run the DynamicJava kernel. Copy the following lines into
.ipython/profile_dynamicjava/ipython_config.py, replacingDYNAMICJAVA_PATHwith the file path ofdynamicjava.jar. Any additional arguments to the JVM should be passed here.c.KernelManager.kernel_cmd = [ "java", "-jar", "DYNAMICJAVA_PATH", "-kernel", "{connection_file}" ] c.Session.key = b'' c.Session.keyfile = b'' -
(Optional) To debug the kernel while it is running, add the following line to the
kernel_cmdlist."-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044",To use the debugger, follow the instructions to configure remote debugging for your IDE (Eclipse, IntelliJ)
-
Configure the IPython Notebook Java syntax highlighting. Copy the files in
profile/static/custom/to.ipython/profile_dynamicjava/static/custom/.
- To build the kernel, run
ant jar. - The IPython console frontend can be run with
ipython console --profile dynamicjava. - To run the web interface, run
ipython notebook --profile dynamicjava.