Running Your Clojure Application Elsewhere

It is one thing to have a nice development environment for running Clojure — mine is Ubuntu Linux — and it is  another to set up other development environments so they will run Clojure. I was expecting the worst. One of my systems is running a Linux 2.4 kernel on Red Hat Enterprise Linux 3. The other systems are fairly up-to-date, and would only require porting the Clojure and related jar files.

After installing the latest java kit according to the directions, I got a strange warning, which disappeared after a reboot:

http://www.linuxquestions.org/questions/linux-software-2/fixing-unknown-vm-type-error-895553/

I had to change my Clojure shell script to point to the new Java directory, so the existing Java was not disturbed.

/usr/share/java/jre1.6.0_21


#!/bin/sh

if [ "x$CLASSPATH" = "x" ] ; then
extra_classpath=""
else
extra_classpath=":$CLASSPATH"
fi

while true ; do
case "$1" in
-cp | -classpath)
extra_classpath=":$2"
shift 2 ;;
--)
shift
break ;;
*)
break ;;
esac
done

exec java -cp  /usr/share/java/jre1.6.0_21/jline.jar:/usr/share/java/jre1.6.0_21/clojure.jar:/usr/share/java/jre1.6.0_21/clojure-contrib.jar:/usr/share/java/jre1.6.0_21/commons-logging-1.1.1.jar:/home/cnorton/git_build/clj-http/clj-http-0.1.3.jar"$extra_classpath" clojure.main "$@"

All in all, the porting was much simpler than I expected. That is a good thing.

Advertisements

Leave a comment

Filed under Clojure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s