Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library does not function in Java 10 #33

Closed
null-dev opened this issue Jun 1, 2018 · 4 comments
Closed

Library does not function in Java 10 #33

null-dev opened this issue Jun 1, 2018 · 4 comments
Labels

Comments

@null-dev
Copy link

null-dev commented Jun 1, 2018

Loading of native libraries fail in Java 10 as the format for the UnsatisfiedLinkError exception message has changed slightly.

Instead of:

no opencv_java320 in java.library.path

it is now:

no opencv_java320 in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]

This will cause the check here to fail:

if (!String.format("no %s in java.library.path", Core.NATIVE_LIBRARY_NAME).equals(ule.getMessage())) {

@null-dev null-dev changed the title Library does not function Java 10 Library does not function in Java 10 Jun 1, 2018
@vonnieda
Copy link
Member

vonnieda commented Aug 4, 2018

It appears there are other problems, too. The @CallerSensitive annotation has been removed. It may be time to rewrite the library loader - or at least borrow heavily from JNAaerator.

@vonnieda vonnieda added the bug label Aug 4, 2018
@vpetit35
Copy link

Yes I faced that same problem when migrating to java10.

I've tried to write my own OpenCV.class for a quick workaround but
final InputStream binary = nu.pattern.OpenCV.class.getResourceAsStream(location); resulted as a nullPointer when called from my custom OpenCV.class (I am still curious how to deal with that classloader problem to get it right btw).

So I've rebuild the jar, after fixing the UnsatisfiedLinkError message and compiled it in java8 (to avoid the @CallerSensitive problem) and it worked fine.

Another workaround I found is to use nu.pattern.OpenCV.loadLocally();
I don't think this could be a problem in my case.

@vonnieda
Copy link
Member

vonnieda commented Nov 17, 2018

This is fixed in 29f5eb0. I'm also working on fixing #38 and once that's fixed I will do a new release to take care of both issues.

@vonnieda
Copy link
Member

This is now fixed in version 3.4.2-1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants