> for anyone who has this same problem. The only solution that I've
> gotten so far that works is to use a java file that launches my
> clojure files. I'm still looking for a better way to do this.

I've had success on several projects with:

(ns com.foo.bar
   (:refer-clojure)
   (:gen-class))     ; I haven't even tried adding :main true.

(defn -main [& args]
   ...)


with the appropriate Ant chunk to build the manifest:

   <!-- Build the classpath to point to any dependencies. -->
   <manifestclasspath property="lib.list" jarfile="${base.jarfile}">
     <classpath refid="manifest.path"/>
   </manifestclasspath>

   <!-- Make the output jar with Main-Class. -->
   <target name="solitary_jar" description="Create jar with pointers  
to dependencies." depends="compile_clojure">
     <jar index="false" jarfile="${solitary.jarfile}">
       <fileset dir="${base.build}" includes="**/*.class,**/ 
*.properties"/>
       <manifest>
         <attribute name="Main-Class" value="com.foo.bar"/>
         <attribute name="Class-Path" value="${lib.list}"/>
       </manifest>
     </jar>
   </target>


This allows you to do

   java -jar my-jar

which, on my Mac at least, means it'll run when you double-click it.

The difference here is that I'm AOT-compiling everything, but you're  
not. Is that correct?

If you're trying to bundle your .clj files into the JAR, you might  
have trouble — you'll need somehow to get Clojure's classloader to  
look for your main class, because the Java classloader won't look  
for .clj files, and wouldn't know what to do with them anyway. gen- 
class only works if you AOT-compile.

I can't see any reason why you wouldn't AOT-compile when you're  
building a jar.
--~--~---------~--~----~------------~-------~--~----~
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