I needed a single jar file that if you double clicked
on it (be in Mac OS X or Windows) it will just launch
my Clojure App.
No CLASSPATH or bash or anything, cross platform.
I didn't found anything like these so I just made it
(I know it's not difficult, let say this is for Newbie!)
The archi is:
- one App on directory: Let say Blop/
- inside one jar: Launcher.jar (double click to start)
- and 2 directories:
- clj/ : with your clojure sources, the entry point must be
named: main.clj
- jar/ : with your needed jar, including: clojure.jar
Look for the "Launcher.jar" file in this Google group.
Here is the source:
(note: Inspired freely from clojure.lang.Script java class)
------------------------------------------------------------
import java.io.OutputStreamWriter;
import java.io.IOException;
import clojure.lang.RT;
import clojure.lang.Compiler;
public class Launcher {
public static void main(String[] args) throws Exception {
try {
RT.processCommandLine(args); // must do that...
Compiler.loadFile("clj/main.clj");
} finally {
OutputStreamWriter w = (OutputStreamWriter)
RT.OUT.get();
try {
w.flush();
w.close();
} catch(IOException e) {
e.printStackTrace();
}
} // try
} // main
}
------------------------------------------------------------
The Manifest must add:
Main-Class: Launcher
Class-Path: jar/clojure.jar
------------------------------------------------------------
As an example I zipped the "Ant" example from Rich Hickey
(only made small modification at the end so that it start right away),
with the lastest (20080916) Clojure.jar .
Look for the "Ant_App.zip" file in this Google group.
Am I re-inventing the wheel ?
Brgds.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---