I think a script like this should be included with the Clojure
download. It's seems to me that everyone needs one and currently has
to write their own by copying example script code from the Getting
Started page. Maybe we can't reach a concensus on everything the
script should do, but providing a good, basic starting point would be
useful. The basic features I would want include:

1) If I run "clj", it starts a REPL.
2) If I run "clj file-path", it runs that file as a Clojure script.
3) Some way to modify the classpath used by the script without
modifying the script.

On Thu, Jan 15, 2009 at 7:58 AM, Stephen C. Gilardi <squee...@mac.com> wrote:
> I've checked in a bash script for launching Clojure to
> clojure-contrib/launchers/bash/clj-env-dir.
>
> It's configured using environment variables (one required and several
> optional). It sets up the CLASSPATH for the Clojure instance it launches
> based on the contents of a directory. This is a mechanism similar to Java's
> java.ext.dirs facility but implemented without using java.ext.dirs. I've
> tested this on Mac OS X Leopard and Ubuntu Intrepid.
>
> Here's a description of the environment variables it uses:
>
> # Environment variables:
> #
> # Required:
> #
> #  CLOJURE_EXT  The path to a directory containing (either directly or as
> #               symbolic links) jar files and/or directories whose paths
> #               should be included in CLASSPATH. These paths will be
> #               prepended to any prior definition of the CLASSPATH
> #               environment variable.
> #
> # Optional:
> #
> #  CLOJURE_JAVA The command to launch a JVM instance for Clojure
> #               default: java
> #               example: /usr/local/bin/java6
> #
> #  CLOJURE_OPTS Java options for this JVM instance
> #               default:
> #               example:"-Xms32M -Xmx128M -server"
> #
> #  CLOJURE_MAIN The Java class to launch
> #               default: clojure.main
> #               example: clojure.contrib.repl_ln
>
> clj-env-dir can be used directly to launch Clojure or as a building block
> for creating launch scripts for a variety of purposes.
>
> Here are two examples of using it as a building block: (these also use
> CLOJURE_CONTRIB whose value should be the path to an svn download directory
> for clojure-contrib)
>
> "clj" (stock clojure.main call, can launch a repl, script, or just eval
> based on arguments to clj)
>
>        #!/bin/bash
>
>        export CLOJURE_MAIN=clojure.main
>        CLJ=$CLOJURE_CONTRIB/launchers/bash/clj-env-dir
>        OPTS=
>
>        exec $CLJ $OPTS "$@"
>
> "cljr" (repl using clojure.contrib.repl_ln)
>
>        #!/bin/bash
>
>        export CLOJURE_MAIN=clojure.contrib.repl_ln
>        CLJ=$CLOJURE_CONTRIB/launchers/bash/clj-env-dir
>        OPTS="--init @repl_init.clj --repl"
>
>        exec $CLJ $OPTS "$@"
>
> --Steve
>
>



-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to