On Oct 14, 10:04 am, Asbjørn Bjørnstad <[EMAIL PROTECTED]> wrote:
>
[..snip..]
> So it is not possible to put the clj files into the jar so that no
> unzipping
> is neccessary? I tried, but my java/jar knowledge is basically zero.
> --
> -asbjxrn
it is definitely possible. To make a jar that doesn't need clojure in
the classpath you need to unpack the clojure jar and repack those
files inside the new jar with your own clojure files.
I have a make-class.clj for a project using what I think maybe
deprecated syntax these days:
(in-ns 'TFC)
(clojure/refer 'clojure)
(load-file "/media/windows/clojure/src/genclass.clj")
(load-file "TFC.clj")
(clojure/gen-and-save-class (first *command-line-args*) 'TFC :main
true)
this makes a class file named TFC.class from the TFC namespace with a
"main" function. The "main" function in the TFC namespace looks like:
(defn main [& strings] ...)
dunno if the [& strings] is required, but it seems like the closest
clojure mapping to java's "main" method signature.
to build the standalone jar file:
1) run make-class.clj which gives me TFC.class from TFC.clj
2) extract clojure.jar into the same directory as TFC.class and
TFC.clj
3) create the jar file specifying "TFC" as the "application entry
point". the exact command line is:
jar cevf TFC tcp-flow.jar *
the resulting is tcp-flow.jar is standalone in the sense that it does
not need a separate clojure.jar in the classpath and all .clj files
are inside the jar
this is a very simple app so there is only one clojure source file. I
am not sure how this would work out with multiple files and such.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---