SpencerPark / IJava

A Jupyter kernel for executing Java code.
MIT License
1.07k stars 211 forks source link

How to import custom script ? #141

Open KubaOfca opened 1 year ago

KubaOfca commented 1 year ago

I want to import a custom java script into an IJava notebook. Is it possible?

I'm trying to do it this way, but it doesn't seem to work. I'm new to "Java" so if I'm doing something wrong please correct me.

My working directory structure:

├── com
│   └── example
│       ├── MyClass.class
│       └── MyClass.java
└── Test.ipynb

Test.ipynb:

image

MyClass.class/MyClass.java:

image

AngryMaciek commented 1 year ago

+1

jimmybow commented 10 months ago

just use %jars XXX.jar

david-romano commented 5 months ago

@jimmybow: But what if you want to import a class that is not contained in a .jar file, as @KubaOfca's example suggests?

jimmybow commented 5 months ago

that's java...not python @@,
so you need to compile your code MyClass.java to a jar library package file.