technology from back to front

Java on .NET

Prompted by Tony, I have played with ikvm, which allows you to run Java programs on .NET. Significantly it facilitates mixing and interop between Java and .NET code, i.e. Java code can call .NET libraries and .NET code can call Java libraries.

As a test, I tried running SISC under ikvm. Amazingly, “it just works”. Even calls to .NET libraries via SISC’s reflection-based Java interop interface work as expected:

C:\programs\sisc-1.13.4\sisc-1.13.4>set java=c:\programs\ikvmbin-\ikvm-\bin\ikvm
SISC (1.13.4)
#;> (import s2j)
#;> (define-java-class <java.lang.System>)
#;> (define-generic-java-method println)
#;> (define-generic-java-field-accessor :out)
#;> (println (:out (java-null <java.lang.System>)) (->jstring "Hello, world"))
Hello, world
#<jnull void>
#;> (define-java-class <cli.system.console> |cli.System.Console|)
#;> (define-generic-java-method write-line |WriteLine|)
#;> (write-line (java-null <cli.system.console>) (->jstring "Hello, world"))
Hello, world
#<jnull void>

There are reports that people have managed to run tomcat on .NET this way!

  1. ikvm is definitely cool. I’ve run Jetty (another Java webserver) and ran our continuation based web server written in Sisc using it under .NET and mono on Linux.

    I was pleasantly surprised to see it work. The whole setup used Jetty, HSQLDB (a java DB), various XSLT and XML transformers and custom Java libraries as well as Sisc. Pretty amazing.


one + = 8

2000-14 LShift Ltd, 1st Floor, Hoxton Point, 6 Rufus Street, London, N1 6PE, UK+44 (0)20 7729 7060   Contact us