would anyone like to help prevent a suicide? I need some help generating a functioning uberjar.
for future reference, you're more likely to get help if you describe the problem - what exactly goes wrong?
thanks, I have a dependency on a project that has a custom java component. eveyrthing is working fine via lein run
, however if I attempt to generate an uberjar and run it. It complains;
java -jar target/uberjar/tickfest-0.1.0-SNAPSHOT-standalone.jar
Exception in thread "main" java.lang.NoClassDefFoundError: qwrap/core/qDict (wrong name: qwrap/core/QDict)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
do you define a class called qDict
with the q lower case?
or perhaps use deftype
or defrecord
to create something called qDict?
the author of the dependency defines a record, yes <https://github.com/echou/qwrap-clj/search?q=qDict&unscoped_q=qDict>
yeah, the normal solution would be to name it as expected - with the first letter capitalized
why does it work fine under lein run
?
alternatively you can avoid aot (using clojure.main as your entry point, not using gen-class), which causes the class to be loaded the same way it would when using lein run
because class files from a resource are not defined the same way as ones created in memory by clojure
when you do (defrecord Foo ...)
in clojure, clojure directly compiles the byte code for a class Foo and injects it into the vm, this is not the same as looking up a class in a jar, and clojure is less picky about things like naming conventions
so you can have names that work without aot, and break with aot, if you don't follow the java naming rules
I see, great catch -- I didn't even notice the case difference in the error.
I'll try a simple rename in my fork of the repo and see if that helps
thanks a lot for your help