I'm here to ask for help to automate a process I saw no other solution than doing it manually.
In one of my projects, I have the following dependencies:
libraryDependencies ++= Seq(
"org.lwjgl" % "lwjgl" % "3.0.0a",
"org.lwjgl" % "lwjgl-platform" % "3.0.0a" classifier "natives-windows" classifier "natives-linux" classifier "natives-osx"
)
This downloads both, the actual .jar and the natives for each platform. Developing this way is no problem. All the dependencies are there and all classes are found.
But compiling and running the application turns out to be a major problem, as you'd get:
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
Now what I do is more than suboptimal, it actually defeats the whole purpose of using managed-libraries: I manually copy the jar and natives to a lib
-directory which is (by default) the sbt default location for unmanaged libraries.
But if I manually have to move it, I can download it manually as well and leave it completely out of the sbt
-file. Not really what I want to do.
How can I automate this process? Generally I thought about two ideas, but have no idea how to properly translate them to sbt
:
- Automatically set the
-Djava.library.path
to the path where the dependencies are located. This path differs from OS to OS and of course I'd like to be able to actually export the project as a runnablejar
some day ;) without major drawbacks or copying around again. - Do what I do now, but automatically: So, move the dependencies to the
lib
-folder.
I can't be the only one struggling with this (or well, maybe I am) but all I found was two "solutions":
- "Do it manually": Can't get LWJGL to run using IDEA and SBT which I - as pointed out in length - find really (less than) suboptimal
- Use https://github.com/philcali/sbt-lwjgl-plugin, but:
Currently SBT version 0.13 is not supported.
is far less than suboptimal (again) :(
Any more ideas? I can't imagine nobody having to deal with natives at all!