java - How to check for DLL/SO before calling JNA Native.loadLibrary to avoid UnsatisfiedLinkError -


i'm loading native library (ffmpeg) using jna need check if dll/so file exists before calling native.loadlibrary(). ffmpeg may not installed in system (it's seperate download).

native.loadlibrary() throws error can not trap try {} catch {}.

how check if library (dll or so) exists before calling loadlibrary()? have parse path environment variable , check myself? have check against windows , linux , ensure correct 32/64bit .dll or .so installed???

i wish loadlibrary returned null pointer or threw exception, not error (bad design).

nevermind, found simple soln.

you can catch on error. thought couldn't. used try {} catch (exception e) {} catch exceptions doesn't catch errors. need use try {} catch (error e) {} or catch (unsatisfiedlinkerror ule) {} instead.

learn new everyday.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -