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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:09:04+00:00 2026-06-16T16:09:04+00:00

I have made a funky application in Clojure with a simple Swing gui containing

  • 0

I have made a funky application in Clojure with a simple Swing gui containing some JButtons with some icons, and I want my non-programmer friends to be able to use it too.

It works all fine on my own computer when I start it with ‘lein run’ but when I create a package with ‘lein uberjar’ and run it, the icons have disappeared leaving the JButtons blank.

The icons are .png’s in the ‘resources’ folder in the project root, and are visible in the .jar after packaging. To load the icons, I do this:

(defn get-icon [icon]
  (.getFile (clojure.java.io/resource icon)))

(def some-button (JButton. (ImageIcon. (get-icon "foo.png"))))

I have tried to put in a little print statement to see, what is going on:

(println (get-icon "foo.png"))

When doing ‘lein run’ it prints

/home/pelle/lein/foo/resources/foo.png

and when doing ‘java -jar’ on the packaged .jar it prints

file:/home/pelle/lein/foo/target/znuli-0.1.2-standalone.jar!/foo.png

which is exactly where foo.png is at (except I am not entirely sure what is going on with the exclamation mark), but it is still not drawn in the Swing gui.

I have also tried explicitly specifying the resources folder in the project.clj with

:resource-paths ["resources"]

but it changes nothing.

So basically my question can be boiled down to this:
How to use ‘lein uberjar’ to create a working hello-world.jar with a JButton containing a custom png-image?

  • 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-06-16T16:09:05+00:00Added an answer on June 16, 2026 at 4:09 pm

    ImageIcon should work fine on a URL. Drop the .getFile call and just use the result of clojure.java.io/resource directly.

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

Sidebar

Related Questions

I have made a Timer application in android containing four activities.Now i when i
I have made an application for IPad in objective C. In this I am
i have made an application having entity framewrok. It is wpf application, now it
I have made an iphone application like flip cards in which values of cards
I have made some code that makes powerpoint and excel work together. And I
I have made an application that can render and save a given element. With
I have made the decision to use monotouch to develop an application that browses
i have made a very simple labview VI which has an activeX component in
I have made an OpenCV application in VC++, whose executable is in the form
I have made a simple web page using jQuery. When opening it on another

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.