Fork me on GitHub
#leiningen
<
2017-08-30
>
bschrag00:08:36

Trying to duplicate this java call in lein---so, get lein's benefits re dependencies and running under CIDER (in Emacs). I gather boot is a viable alternative, and I'd consider trying that if lein's just not capable. java -classpath C:\Users\Schrag\.m2\repository\org\clojure\clojure\1.8.0\clojure-1.8.0.jar;c:\NeticaJ_Win\NeticaJ_504\bin\NeticaJ.jar -Djava.library.path=c:\NeticaJ_Win\NeticaJ_504\bin clojure.main Launching as above, this call works.

user=> (norsys.netica.Environ. nil)
#object[norsys.netica.Environ 0x6ca18a14 "norsys.netica.Environ@6ca18a14"]
With these lein defproject configuration clauses (also when omitting the Clojure JAR)...
:jvm-opts ["-Djava.library.path=c:/NeticaJ_Win/NeticaJ_504/bin/" ; NeticaJ.lib
             ;; Guessed this, project doesn't seem to launch with it: "-Ljava.library.path=c:/NeticaJ_Win/NeticaJ_504/bin"
             ]
  :resource-paths ["C:/Users/Schrag/.m2/repository/org/clojure/clojure/1.8.0/clojure-1.8.0.jar;C:/NeticaJ_Win/NeticaJ_504/bin/NeticaJ.jar"]
...I get this error:
edit-server.core> (norsys.netica.Environ. nil)
UnsatisfiedLinkError C:\NeticaJ_Win\NeticaJ_504\bin\NeticaJ.dll: Can't find dependent libraries  java.lang.ClassLoader$NativeLibrary.load (ClassLoader.java:-2)
I've gotten some good help on this (today on #clojure) from @noisesmith, but we're stuck here. For context, I'm trying to port a third-party API to Clojure. API was originally written in C, vendor has packaged this as JNI, providing Java API. Vendor's java bin directory includes .jar, .dll, and .lib files. I am new to Clojure (longtime Common Lisper), have no real Java background. Using Windows. Ideas? Thanks...

noisesmith00:08:47

try putting ^:replace between :jvm-opts and the vector after it

noisesmith00:08:18

the default is to merge lein’s preferred opts in, that can lead to unexpected behavior if contradictory options are provided

noisesmith00:08:18

I just noticed you turned the \ into / - was that because of quoting issues?

noisesmith00:08:28

try just replacing each \ in the original with \\

noisesmith00:08:54

if that’s the thing that did it, I’d consider that a lein bug maybe (I have seen errors in other clojure libs trying to be clever and use system.path_separator or whatever it is called when really windows is OK with either and then missing the real file path separator)

noisesmith00:08:44

it’s “file.separator” I’m thinking of

bschrag00:08:28

lein interpreted "\Users" as \U (undefined) + "sers". Will try \\.

bschrag00:08:14

No change. I'm inclined to think / is ok, since it works everywhere else in defproject---e.g. :target-path.

bschrag00:08:27

And it's acting like it can find the class but can't traverse a link. So, at least one of those two clauses must be well-formed.