Specify ClassPath when using jupyter + Java with WSL

Set the classpath when using JupyterLab + Java.

Where is the config file

$ jupyter kernelspec list

java       /path/to/jupyter/kernels/java
python3    /path/to/jupyter/kernels/python3

I will make a kernel called java-lib which is different from normal Java

$ 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

Specify ClassPath when using jupyter + Java with WSL
Using JupyterLab + Java with WSL on Windows 10
Error when playing with java
Using Mapper with Java (Spring)
Try using Redis with Java (jar)
Unexpected exception when using Java DateTimeFormatter
Using Java with AWS Lambda-Eclipse Preparation
Html5 development with Java using TeaVM
Using proxy service with Java crawling
Let's specify the version when using docker
Using Java with AWS Lambda-Implementation-Check CloudWatch Arguments
Using Java with AWS Lambda-Implementation-Stop / Launch EC2
Memo when HTTP communication with Java (OkHttp)
Game development with two people using java 2
I tried using OpenCV with Java + Tomcat
Image flew when updating Docker with WSL2
Game development with two people using java 1
Using hidden type when PUT with Thymeleaf
When calling API with java, javax.net.ssl.SSLHandshakeException occurs
GPU recognition with docker using WSL2 (August 2020)
[Java] Precautions when comparing character strings with character strings
Game development with two people using java 3
Try using the Wii remote with Java
Be careful when using rails_semantic_logger with unicorn
Be careful with requests and responses when using the Serverless Framework in Java
Using templates on the classpath with Apache Velocity
Interact with LINE Message API using Lambda (Java)
Verification of performance impact when using Java volatile
Using Gradle with VS Code, build Java → run
Make Volume faster when using Docker with vscode.
You also need to specify the host when debugging remotely with Java 9 or later
Using Java 8 with Bluemix (on Liberty Runtime & DevOps Service)
[Java] Consideration when handling negative binary numbers with Integer.parseInt ()
Don't forget setCalendar or setTimeZone when using Java DateFormat
[Note] Configuration file when using Logback with Spring Boot
[Java] [Spring Boot] Specify runtime profile --Spring Boot starting with NetBeans
Whether to enable SSL when using JDBC with MySQL.
Notice multi thread problem when working with Java Servlet
Build Java development environment with WSL2 Docker VS Code
Differences in code when using the length system in Java
[Java] Development with multiple files using package and import