web starting clojure apps without Java code

37 views
Skip to first unread message

Eugen Dück

unread,
Mar 17, 2010, 10:56:44 AM3/17/10
to Clojure
All,

Developing in clojure is a lot of fun, at least it was for me and a
project of mine - except for one thing: Deploying the app as Java Web
Start app, that took me a bit of time to figure out, and not only
because Java Web Start is broken in debian squeeze (for a workaround,
see bugs.debian.org/560056 ).

Java Web Start has been discussed in this group some time ago (
http://groups.google.com/group/clojure/browse_thread/thread/f0c69735c5a9bd03/
), and the proposed solution at that time contained one Java class
that did some static initialization (to propagate the necessary
permissions to clojure's own classloader) and then went on to call RT
to load a clj file, after fiddling around with PushBackReaders and so
forth.

I would like to stay away from RT, as it can change, and I don't want
to depend on RT staying the way it is. Now it turns out that Web Start
is actually pretty easy if you just AOT your whole app and gen-class
your main entry point. That way you don't need any Java code.

My clj file that contains the entry point starts like this:

(ns kanshiki.swing
(:gen-class))

Then I compile the app and create the jar file:
mkdir classes
java -cp clojure.jar:clojure-contrib-slim.jar:classes:. clojure.main -
e "(compile 'kanshiki.swing)"
(cd classes; jar cf ../kanshiki-boom.jar *)
jarsigner kanshiki-boom.jar

And the jnlp contains these tags to make it work:
...
<resources>
<j2se version="1.6*"/>
<jar href="clojure.jar"/>
<jar href="kanshiki-boom.jar" main="true"/>
</resources>
<application-desc main-class="kanshiki.swing"/>
...

The complete jnlp can be found at http://dueck.org/kanshiki-boom/ .

I plan to introduce and document this beta-grade app soon, but if
there's any Japanese learner out there interested in or in need of
Kanji handwriting recognition, check it out, but please hold back with
any bug reports etc. until I have introduced it.

Only one quick note: Kanjis you click will automatically be copied to
the clipboard, so if you use it together with a kanji dictionary that
can search the clipboard like kiten (yes, that's the KDE kanji
dictionary with the huuuuge memory leak, the other day it grew to 6GB
before I killed it), it is actually useful to look up kanjis or words.

Oh, and did I mention lately that clojure is pure fun? Thanks again
Rich! You've done (and are still doing) a terrific job!

Eugen

LauJensen

unread,
Mar 18, 2010, 4:15:35 AM3/18/10
to Clojure
Eugen,

Fantastic insight - I cant wait to work that into a blogpost :)

Lau

On 17 Mar., 15:56, Eugen Dück <eu...@dueck.org> wrote:
> All,
>
> Developing in clojure is a lot of fun, at least it was for me and a
> project of mine - except for one thing: Deploying the app as Java Web
> Start app, that took me a bit of time to figure out, and not only
> because Java Web Start is broken in debian squeeze (for a workaround,
> see bugs.debian.org/560056 ).
>

> Java Web Start has been discussed in this group some time ago (http://groups.google.com/group/clojure/browse_thread/thread/f0c69735c...

Eugen Dück

unread,
Mar 19, 2010, 7:49:46 AM3/19/10
to Clojure
That would be great! Please post the link here when you're done.

Zmitro Lapcjonak

unread,
Mar 23, 2010, 4:30:16 AM3/23/10
to Clojure

On Mar 17, 4:56 pm, Eugen Dück <eu...@dueck.org> wrote:

> The complete jnlp can be found athttp://dueck.org/kanshiki-boom/.
>
> I plan to introduce and document this beta-grade app soon, but if
> there's any Japanese learner out there interested in or in need of
> Kanji handwriting recognition, check it out, but please hold back with
> any bug reports etc. until I have introduced it.

i started and tryed a little the app.
it downloaded (something from your site) then i was able to draw.
i drawed some basic kanji (even those found in unistrok.data)
pressed left button (the right works as "undo").
but observed no reply from the app.
so, lets wait untill you anonce not-beta state of your app.

good luck!

--
zmitro lapcionak

Eugen Dück

unread,
Mar 24, 2010, 8:06:34 AM3/24/10
to Clojure
Hi Zmitro,

you should see kanjis being detected as you draw the strokes. Maybe
the app didn't re-layout properly, that's why you didn't see the kanji
panel on the right hand side. I changed the jar slightly, and if the
re-layout thing was the reason, it could be fixed now. if you still
only see a white panel, try resizing the window. But it should re-
layout automatically now.

And make sure to draw the strokes in the right order and direction.

Cheers
Eugen

Eugen Dück

unread,
Mar 24, 2010, 10:49:29 AM3/24/10
to Clojure
I just tried starting it from a Windows box, and for some reason, the
kanjis are not displayed there. Maybe it's a font issue, not sure yet.
Will investigate.

Eugen Dück

unread,
Mar 25, 2010, 8:48:42 AM3/25/10
to Clojure
I fixed a couple of other issues, most of which show only on Windows.
You should see Kanjis now on the right-hand side when drawing.

Eugen

On Mar 23, 5:30 pm, Zmitro Lapcjonak <idob...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages