Closed thebrightspark closed 3 years ago
The general problem with loading it from an arbitrary URL is that the operating system usually requires native libraries to be loaded from a real file.
So the native library needs to be unpacked/copied in any case.
I'd recommend doing that manually for now (you can look at examples/DownloadNativeLibrary.java
for reference and use Files.copy(...)
for copying the resource to a temporary file).
But I will add a method to load it from a URL soon, as it would probably be very useful feature!
Ah okay then.
Yes, for now I've gotten around it by copying the file to a temporary location, inspired by your download example.
Thanks a lot for your response!
Hopefully fixed in a2db44e1bee7d25f0fe07d96a17ef7589b718b77
So I'm packaging the Discord Game SDK within the resources of a Minecraft mod so that I can have custom rich presence for the game. However, creating an instance of
Core
requires aFile
, which is not possible since one cannot be created for a JAR resource. It's fine when testing within the IDE, but not for a built JAR.It'd be great if this could be changed to accommodate both a file on the file system or a JAR resource if possible please.
The exception I see is (omitting irrelevant lines):
With code that looks like this:
And the exception would be thrown at the line:
Core.init(new File(url.toURI()));
.