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 6964561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:56:25+00:00 2026-05-27T15:56:25+00:00

Begin Edit: Primarily I want my Clojure program to use a Java class. I’ve

  • 0

Begin Edit:
Primarily I want my Clojure program to use a Java class.

I’ve also gotten some good advice on going back to lein from cake, because they’re
merging.

If anyone reading this can recommend a book more for setting up a Java/Clojure build environment than learning Java, I would appreciate it.
End Edit:

Although I can read Java code, I am not a Java programmer. I am building Clojure main programs successfully using cake, and need to create a Java class that becomes part of my Clojure main. I cannot figure out how to incorporate the MyClass.class into the Clojure build.

First here is my project.clj followed by a few lines of the application .clj file.

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

(ns ba2-app
    (:gen-class)
    (:use [clojure.string :only [split]]
          [clojure.string :only [join]]))

(def^:dynamic avail-trans [\W \D])
(def^:dynamic acct-types [[\C 0.02][\S 0.04] [\M 0.06]])
.
.
.

1) Should the .java file go into the same directory as the .clj application module?

2) What would the build instructions be?

Thanks.

  • 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-27T15:56:26+00:00Added an answer on May 27, 2026 at 3:56 pm

    It is not exactly clear what you want to do. I assume that you want to compile java class and use in your clojure sources. In this case you don’t have to do something special. Put your java classes where you want (say, dir ‘/project_dir/src’) and add

    :java-source-path "src"
    

    to your project.clj file. In this case java classes will be compiled along with clojure files, and their package hierarchy root will start from this directory you’ve chosen. You can now use these classes like you woul use any other classes – :import clause in (ns ...) form or direct (import ...).

    UPD. It could also be mentioned that you can freely mix your java source directory with your clojure sources, so you can have project.clj options :source-path and :java-source-part set to the same value, “src” in this example.

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

Sidebar

Related Questions

I have a very large database (~100Gb) primarily consisting of two tables I want
Current Code: - (void)textFieldDidBeginEditing:(UITextField *)textField { NSLog(@begin edit: %@, textField); } Related output: 2011-10-30
I am designing some system that will store records containing a begin and end
I am doing some performance testing on a SQL sproc and just want to
Begin Edit: Mea Culpa! I apologize. I was running this in the cake repl
Edit: Translated I have a RSS-feed that i want to parse. It's a podcast
Edit: original question below, but I revise it now that I have some code
To begin i read all resources from xml in my MergedDictionaries and now I
To begin with, let me say that I understand how and why the problem
To begin with, I'm not even sure, if it is the right way to

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.