Set the classpath when using JupyterLab + Java.
$ jupyter kernelspec list
java /path/to/jupyter/kernels/java
python3 /path/to/jupyter/kernels/python3
$ cd /home/user_name/.local/share/jupyter/kernels/ $ mkdir java-lib $ cd java-lib $ ln -s ../java/ijava-1.3.0.jar $ cp ../java/kernel.json ./ $ vi kernel.json
kernel.json
{
"argv": [
"java",
"-Xmx8g",
"-cp",
"/path/to/lib/dir/*:/path/to/java-lib/ijava-1.3.0.jar",
"io.github.spencerpark.ijava.IJava",
"{connection_file}"
],
"display_name": "Java-lib",
"language": "java",
"interrupt_mode": "message",
"env": {
}
}
did it. If the classpath appears in a sloppy manner with the following code, it is successful.
Properties properties = System.getProperties();
String clsPath = properties.getProperty("java.class.path");
System.out.println(clsPath);
However, it seems that the classpath cannot be changed for each executable file. Well, it seems quite so with the punishing method of putting all the jar files in a specific lib file.
However, I'm so used to Eclipse that I'm not sure how much code I can write in JupyterLab, where completion doesn't work very well ...
Recommended Posts