I have a clojure project that uses the slick 2d game engine that I am trying to run as an executable jar file. I created the project in both Netbeans and Eclipse and I have had no luck exporting them into an executable format. It keeps giving the error could not find the main class, followed by giving my main class. I have tried editing the manifest file changing the name in the hopes that it will find it but no luck so far.
It does run in the development environment, but not outside it.
It's been a while since I posted this question and I thought that I would stick up what I've found since for anyone who needs this question answered.
I now use Leiningen to manage my projects though I have started playing around with cljr which is a repl and package manager that complements it. Either of these make it much simpler to generate a runnable jar file.
Taking Leiningen as an example set it up using the instructions on the site and then call lein new
in your workspace. This will create a folder to house your projects as well as a sub-folders for your source and tests a readme file and a project.clj file.
Edit the project.clj with the dependencies that you will be using. Dev-dependencies are dependencies which you need purely for development such as swank-clojure shown in the example below.
(defproject myproject "0.0.1-SNAPSHOT"
:description "My Personal Project."
:url "http://example.com/my-project"
:dependencies [[org.clojure/clojure "1.1.0"]
[org.clojure/clojure-contrib "1.1.0"]
[**other dependencies**]]
:dev-dependencies [[swank-clojure "1.2.1"]]
:main [org.myproject.core])
I find swank-clojure useful as you can then type lein swank
to start a swank instance which you can connect to via emacs.
:main defines what namespace contains the -main function.
Calling lein uberjar
will create a standalone jar which will then run.
Hopefully that helps anyone who had my problem!