On Jan 17, 7:42 am, Robert McIntyre <r...@mit.edu> wrote:
> You can then actually run your program by making a shell script with
> something like
> #!/bin/bash
> java -Xmn500M -Xms2000M -Xmx2000M -server -cp ./lib/*:./src
> clojure.main your-namespace-file.clj  $@
>
> A little known fact is that the above can actually be embedded into a
> clojure source file with the following trick:
>
> Make this the first line of your clojure namespace to make it executable:
>
> ":";exec java -verbose:gc -Xmn500M -Xms2000M -Xmx2000M -server -cp
> "your-classpath" clojure.main $0 $*;
>
> The trick is putting the ":"; at the beginning and then calling exec.
> To clojure this looks like a literal string followed by a comment.  To
> bash it looks like a no-op followed by an invocation of java on the
> file itself, and no lines after the first ever get executed. You can
> make whatever class structure you cant and then just symlink the
> clojure file to be an executable file at the base of the directory.
> You can still always go the shell script route if you don't like the
> embedding trick. This technique is common with emacs-lisp to make
> things executable.

Instead of a trick, why not use the fact that clojure treats #! as a
single-line comment? Then you can write your shebang line just like
every other scripting language.

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
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