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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:07:24+00:00 2026-06-14T08:07:24+00:00

I was wondering if anybody has any experience with obfuscating their leiningen compiled uberjars

  • 0

I was wondering if anybody has any experience with obfuscating their leiningen compiled uberjars with proguard. I’ve tried my best to look for a solution on Google but couldn’t really find an answer. I’m wondering if this is at all possible.

I’ve been trying to obfuscate a default lein project. Here’s the core.clj file:

(ns proguard.core
(:gen-class))

(defn -main
  "I don't do a whole lot."
  [& args]
  (println "Hello, World!"))

the project file:

(defproject proguard "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}
  :dependencies [[org.clojure/clojure "1.4.0"]]
  :aot :all
  :main proguard.core)

and my proguard config file:

-injars clojure/proguard/target/proguard-0.1.0-SNAPSHOT-standalone.jar
-outjars clojure/test-project

-libraryjars /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar

-dontshrink
-dontoptimize
-dontusemixedcaseclassnames
-dontpreverify
-dontnote
-printseeds

-keepclasseswithmembers public class * {
    public static void main(java.lang.String[]);
}

-keep class clojure.core__init { public static void load(); }
-keep class clojure.core_proxy__init { public static void load(); }
-keep class clojure.core_print__init { public static void load(); }
-keep class clojure.genclass__init { public static void load(); }
-keep class clojure.core_deftype__init { public static void load(); }
-keep class clojure.core.protocols__init { public static void load(); }
-keep class clojure.gvec__init { public static void load(); }
-keep class clojure.java.io__init { public static void load(); }
-keep class clojure.lang__init { public static void load(); }

-keep class proguard.core__init {
    public static void load();
}
-keep class proguard.core {
    public *** super*(...);
}

Whenever I try to run the obfuscated jar I get the following errors:

Exception in thread "main" java.lang.ExceptionInInitializerError
    at clojure.lang.ve.<init>(Unknown Source)
    at clojure.lang.ve.c(Unknown Source)
    at clojure.lang.yf.a(Unknown Source)
    at proguard.core.<clinit>(Unknown Source)
Caused by: java.lang.ClassNotFoundException: clojure.lang.PersistentList, compiling:(clojure/core.clj:20)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.at.b(Unknown Source)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.bj.a(Unknown Source)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.at.b(Unknown Source)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.at.a(Unknown Source)
    at clojure.lang.xh.a(Unknown Source)
    at clojure.lang.xh.a(Unknown Source)
    at clojure.lang.xh.b(Unknown Source)
    at clojure.lang.xh.d(Unknown Source)
    at clojure.lang.xh.c(Unknown Source)
    at clojure.lang.xh.<clinit>(Unknown Source)
    ... 4 more
Caused by: java.lang.ClassNotFoundException: clojure.lang.PersistentList
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at clojure.lang.ec.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:247)
    at clojure.lang.xh.h(Unknown Source)
    at clojure.lang.bp.b(Unknown Source)
    at clojure.lang.bp.a(Unknown Source)
    at clojure.lang.bq.a(Unknown Source)
    ... 19 more

I’m not really sure what I’m doing wrong here… I’ve tried to follow a clojure targeted proguard tutorial obfuscating with proguard, however it is android and ant specific so I’m wondering if the process is entirely different for desktop applications that use lein.

Thanks in advance.

  • 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-14T08:07:25+00:00Added an answer on June 14, 2026 at 8:07 am

    Copied from above:

    Obfuscating uberjars

    1. Preparing your project.clj file

    Here’s a copy of mine (simple, default lein project, with comments):

    (defproject proguard "0.1.0-SNAPSHOT"
      :description "FIXME: write description"
      :url "http://example.com/FIXME"
      :license {:name "Eclipse Public License"
                :url "http://www.eclipse.org/legal/epl-v10.html"}
      :dependencies [[org.clojure/clojure "1.4.0"]]
      :main proguard.core
      ;;; Make sure everything is aot compiled
      :aot :all
      ;;; Remove source .clj files from the resulting jar
      :omit-source true
      )
    

    There isn’t much more to it here… Also make sure that (:gen-class) is included in your namespace declarations.

    Build the uberjar with lein uberjar and we are off to the next step.

    2. Preparing your ProGuard config file

    Once again a copy of my file follows with annotations

    # Our uberjar
    -injars clojure/proguard/target/proguard-0.1.0-SNAPSHOT-standalone.jar
    # Our output direcotry
    -outjars clojure/obfuscated
    
    # Link to rt.jar. I'm on a Mac so your path may differ
    -libraryjars /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar
    
    # ProGuard options. Detailed explanation here http://proguard.sourceforge.net/index.html#manual/usage.html
    -dontskipnonpubliclibraryclassmembers
    -dontnote
    -printseeds
    
    # What we will be doing is obfuscating, shrinking and optimizing the jar. 
    # If you experience any problems start out with obfuscation and add the 
    # -dontoptimize  and the -dontshrink flags and see if it works.
    
    # Tell proguard to leave the clojure runtime alone
    # You would need to add any other classes that you wish to preserve here.
    -keep class clojure.** { *; }
    
    # Keep our core__init class
    -keep class proguard.core__init {
        public static void load();
    }
    
    # Keep classes that contain a main method (otherwise we won't be able to run the jar)
    -keepclasseswithmembers public class * {
        public static void main(java.lang.String[]);
    }
    

    Thats it. Now run proguard with your new configuration file java -jar proguard.jar @myconfig.pro. You should see a bunch of output due to the -printseeds flag (which you of course can remove if you don’t want to see which classes will be kept by proguard).

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

Sidebar

Related Questions

I'm wondering if anybody has had any experience in trying to install SQL Server
Hi I'm wondering if anybody has had any experience querying a Team Foundation Server
I was wondering if anybody has any idea why the SynchronizedCollection<T> class was implemented
Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality.
I was wondering if anybody has any suggestions for how to install and relaunch
Just wondering if anybody has run Scala app or web-app on Java Real-Time system?
I was wondering if anybody has seen a technique for adding Maven dependencies to
I was wondering if anybody had any good sources for a game structure. I
I was wondering if anybody has ever seen a combination vertical and horizontal jQuery
I'm wondering if anybody has run across something similar to this before. Some quick

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.