scijava / scijava-jupyter-kernel

[RETIRED] Try IJava or BeakerX
Apache License 2.0
178 stars 42 forks source link

Java support #80

Closed afayes closed 5 years ago

afayes commented 7 years ago

The README.md at https://github.com/scijava/scijava-jupyter-kernel mentions Java suppport

Some of the supported languages are Groovy (default), Python, Beanshell, Clojure, Java

However I could not get Java code to work.

I tried Java code by doing:

#!java
String name = "Java"

I get the following error in the terminal ERROR] Script Language for 'java' not found

If I don't specify a language through the hash syntax the default is Groovy and so the following which is valid Java but invalid Groovy does not work int[] a = {1}

I get a long stack trace inside Jupyter Notebook org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'Script1$_run_closure1@e493dee' with class 'Script1$_run_closure1' to class 'int' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToNumber(DefaultTypeTransformation.java:163)...

hadim commented 7 years ago

We want to make this kernel working with Java but that's true that it's not working at the moment. Unless you can contribute, you'll have to wait that me or someone else fix it.

apohllo commented 6 years ago

This is kind of surprising, taking into account the fact that Java 9 is shipped with jshell. Maybe it would be possible to at least support that version?

ctrueden commented 6 years ago

@apohllo This kernel is built on Java 8, not Java 9. The SciJava ecosystem in general is not yet compatible with Java 9. But we are definitely excited about it and will explore it as time permits.

I also want to add that BeanShell and Groovy are really close to Java. So if your goal is fast prototyping of Java code, you can certainly come very close to that already.

apohllo commented 6 years ago

Ok, thanks for the clarification. It's a pity that there is no working Java kernel at present :/

bhugueney commented 6 years ago

While support for Java would (will !) be awesome, in the meantime I suggest fixing the Readme.md. Line 11 reads «Some of the supported languages are Groovy (default), Python, Beanshell, Clojure, Java,[…]» which sent me to a frustrating wild-goose chase. (Thanks for this wonderful project, however, I'll be very happy to use it with Clojure !)

ctrueden commented 5 years ago

For now, I removed Java from the list of languages this kernel supports.

The current plan is to retire this kernel in favor of individual kernels shipped by BeakerX, which include Groovy, Clojure, Java, Kotlin and Scala. If there are compelling reasons to keep maintaining SciJava Jupyter Kernel for the community (e.g. someone has a concrete use case for the fluid polyglot feature that cannot be accomplished with BeakerX's limited polyglot support?), I'd love to hear them.