On 17 January 2011 17:42, Robert McIntyre <[email protected]> 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 $@
Put $@ in double quotes. Otherwise bash will split up your args on
whitespace before calling java.
/tmp$ cat java
#!/bin/sh
for arg; do
echo "\"$arg\""
done
/tmp$ cat launcher
#!/bin/sh
/tmp/java $@
/tmp$ ./java "This should be one arg"
"This should be one arg"
/tmp$ ./launcher "This should be one arg"
"This"
"should"
"be"
"one"
"arg"
> 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 $*;
Similarly here, $* should be "$@". Also, do you need the trailing semicolon?
--
Michael Wood <[email protected]>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en