     start_compile=(new Date()).getTime()
     jvm.set_classpath '/home/doppio/vendor/classes/', './:/home/doppio'
     user_input = (resume) -> resume ''
-    bs_cl = new ClassLoader.BootstrapClassLoader(read_classfile)
-    rs = new runtime.RuntimeState(stdout, user_input, bs_cl)
+
+    rs = new runtime.RuntimeState(stdout, user_input, root.bs_cl)
+    root.rs = rs
     args = [ fname ]
-    my_cb = ->
+    my_cb = (success) ->
         end_compile=(new Date()).getTime()
+        root.rs = null
         console.log "javac took a total of #{end_compile-start_compile}ms."
-        $('#messages').text 'Compilation complete'
+        if success
+            $('#messages').text 'Compilation complete'
+        else
+            $('#messages').text ''
         finish_cb()
-    jvm.run_class rs, 'classes/util/Javac', args, my_cb
+    useECJ = true
+    if useECJ
+        jvm.system_properties['jdt.compiler.useSingleThread'] = true
+        #Could play with -noExit too
+        jvm.run_class rs, 'org/eclipse/jdt/internal/compiler/batch/Main', args, my_cb
+    else 
+        jvm.run_class rs, 'classes/util/Javac', args, my_cb
     return
 
 root.exec = (stdout,stdin, class_name,class_args, finish_cb) ->
     $('#messages').text "Running #{class_name}"
-    bs_cl = new ClassLoader.BootstrapClassLoader(read_classfile)
-    rs = new runtime.RuntimeState(stdout, stdin, bs_cl)
+    rs = new runtime.RuntimeState(stdout, stdin, root.bs_cl)
     jvm.run_class(rs, class_name, class_args, finish_cb)
     $('#messages').text ''
     return

    stdin = -> "\n"
    class_args = [ fname ]
    exec_finish_cb = ->
         console.log 'Done'
    compile_finished_cb  = ->
        if msg.length ==0
            root.exec stdout, stdin, cname, class_args, exec_finish_cb
    root.compile stdout, fname, compile_finished_cb

root.preload = ->
    load_mini_rt()
    init_editor()
    
    root.bs_cl = new ClassLoader.BootstrapClassLoader(read_classfile)
    
    $('#run_btn').click (e) ->
        compileAndRun()
        e.preventDefault()
    $('#abort_btn').click (e) ->
        console.log 'abort button clicked'
        if root.rs
            $('#messages').text 'Stopping ...'
            root.rs.async_abort() 
        else
            console.log 'but nothing to do'
        e.preventDefault()


    
$(document).ready ->
    root.preload()

root.rs = null

root.saveFile = (fname,contents) ->
    contents += '\n' unless contents[contents.length-1] == '\n'
