Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6914081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:18:06+00:00 2026-05-27T09:18:06+00:00

I have a clojure application called mr1; its project.clj is located in ./mr1/, and

  • 0

I have a clojure application called mr1; its project.clj is located in ./mr1/, and mr1.clj is located in ./mr1/src.

I cannot figure out how to structure the directories, namespace, and project.clj file correctly, so I can build a binary using cake bin.

Enclosed are my current project.clj and the head and tail of mr1.clj.

src/mr1.clj loads fine into cake repl and executes. cake bin produces an mr1 file that contains no -main.

(defproject mr1 "0.0.1-SNAPSHOT"
  :description "TODO: add summary of your project"
  :dependencies [[org.clojure/clojure "1.3.0"]
                 [org.clojure/tools.cli "0.1.0"]]
   :main mr1)

(ns mr1
    (:use [clojure.string :only [split]]
          [clojure.string :only [join]]))

.
.
.

(defn -main 
    [& args]
    (do
       (reset! grid-dim (prompt-for-grid-dim))
       (reset! mr1-pos (prompt-for-rover-pos 1))
       (let [moves (prompt-for-rover-moves)]
           (execute-each-move moves @mr1-pos))

       (reset! mr2-pos (prompt-for-rover-pos 2))
       (let [moves (prompt-for-rover-moves)]
           (execute-each-move moves @mr2-pos))


    )
)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:18:07+00:00Added an answer on May 27, 2026 at 9:18 am

    As I mentioned in answer to your first question, you have to enable AOT-compilation of your namespace. I’ve copied that answer here in case if someone would have same problem.

    As sample.project.clj file says, :main key should have as an assigned value a namespace which contains -main function. So you should have such function

    (defn -main [& args]
      (do-things-you-want-to-do-on-program-start))
    

    in your mr1.clj. Also AFAIR if you want to use your program as a standalone jar you have to have this namespace gen-classed. By this I mean that you have to:

    1. Include :gen-class option in your namespace definition like this:

      (ns mr1
        (:gen-class)
        ...other options...)
      
    2. Make the namespace AOT-compiled (AOT stands for Ahead Of Time). To do this you need to specify your namespace in the list of AOT-compiled namespaces in project.clj:

      (defproject mr1 "0.0.1-SNAPSHOT"
        ...other definitions...
        :aot [mr1]
        :main mr1)
      

    After you’ve done this, you can use cake to generate executable jar for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multithreaded application written in Clojure. There is a problem of making
I have a clojure program that at some point executes a function called db-rebuild-files-table
Is it possible to include (import?) other files into the project.clj for a clojure
this is my project.clj file: (defproject org.github.pistacchio.deviantchecker 0.9.0 :description A one page application for
in clojure i have vector [myfn1 myfn2 myfn3] how can i call functions named
I have the following Clojure code and I'm not sure why it's not working:
I have a couple of questions about Hello World in Clojure: (println Hello, world!)
My adventures in Java have lead me to look into Clojure, which then lead
I tried the following in Clojure, expecting to have the class of a non-lazy
What I would like to do (in Clojure): For example, I have a vector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.