java command with deps.edn

132 views
Skip to first unread message

ru

unread,
Jun 17, 2018, 3:34:59 PM6/17/18
to Clojure
Dear Clojure users and team!

How to start clojure program with dependencies (deps.edn) without installing command line tools, leiningen, boot and so on, with only java command on command line? 

Thanks in advance.

Sincerely,
  Ru

Alex Miller

unread,
Jun 17, 2018, 6:38:26 PM6/17/18
to Clojure
If you want to start a Clojure program with deps, you need a tool with the ability to determine transitive deps. So you’ll need something - clj is probably the easiest.

ru

unread,
Jun 18, 2018, 6:57:46 AM6/18/18
to Clojure
Thank you, Alex!

In general, I think about simplest way to deploy clojure programs for non-programmers, who don't interested in additional installations. I have tried to use uberjar from Leiningen, but it did not work. May be, because of quite a lot of different libraries and jars in my build. 
What can you advice?

Thanks in advance,
  Ru

понедельник, 18 июня 2018 г., 1:38:26 UTC+3 пользователь Alex Miller написал:

Alex Miller

unread,
Jun 18, 2018, 7:35:13 AM6/18/18
to Clojure
What didn’t work?

ru

unread,
Jun 18, 2018, 10:17:54 AM6/18/18
to Clojure
When I start as "lein run" all is well.
But, when I start throught "java -jar target/simpro-scene-0.1.0-SNAPSHOT-standalone.jar" I get this error message:

Ruslans-iMac:simpro-scene ru$ java -jar target/simpro-scene-0.1.0-SNAPSHOT-standalone.jar 


Protege-3.5

A free, open-source ontology editor and framework for building intelligent systems

(http://protege.stanford.edu/)


Exception in thread "main" java.lang.NoClassDefFoundError: edu/stanford/smi/protege/Application

at simpro_scene.core$_main.invokeStatic(core.clj:8)

at simpro_scene.core$_main.doInvoke(core.clj:4)

at clojure.lang.RestFn.invoke(RestFn.java:397)

at clojure.lang.AFn.applyToHelper(AFn.java:152)

at clojure.lang.RestFn.applyTo(RestFn.java:132)

at simpro_scene.core.main(Unknown Source)

Caused by: java.lang.ClassNotFoundException: edu.stanford.smi.protege.Application

at java.net.URLClassLoader$1.run(URLClassLoader.java:372)

at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:360)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

... 6 more



Class edu.stanford.smi.protege.Application exists in 

simpro-scene-0.1.0-SNAPSHOT-standalone.jar



понедельник, 18 июня 2018 г., 14:35:13 UTC+3 пользователь Alex Miller написал:
What didn’t work?

Alex Miller

unread,
Jun 18, 2018, 10:48:32 AM6/18/18
to Clojure
You seem to be pulling in a bunch of jars by including them directly in the project (https://github.com/rururu/simpro-scene/tree/master/lib) rather than referring to them as Maven artifacts. uberjar doesn't know how to pull in and integrate loose jars like that (afaik). Is there some reason you're doing this?  Most (maybe all) of those jars are available in Maven repos as artifacts. If you were able to move them into your lein deps, I think uberjar would do the right thing.

ru

unread,
Jun 18, 2018, 11:43:31 AM6/18/18
to Clojure
Thanks for the advice. I'll try to search them in Maven repos and move my own one there.

Sincerely,
  Ru

понедельник, 18 июня 2018 г., 17:48:32 UTC+3 пользователь Alex Miller написал:
Reply all
Reply to author
Forward
0 new messages