no jniopencv_highgui in java.library.path

1,006 views
Skip to first unread message

Deepak Pal

unread,
Feb 21, 2016, 7:02:57 PM2/21/16
to javacv
Please Help me I am getting the following exception when i am trying to run a simple program

following is the error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_highgui in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_highgui.<clinit>(opencv_highgui.java:79)
at JavaCv1.main(JavaCv1.java:22)
Caused by: java.lang.UnsatisfiedLinkError: C:\Users\Deepak\AppData\Local\Temp\javacpp4684178345609\jniopencv_highgui.dll: Access is denied
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.load0(Unknown Source)
at java.lang.System.load(Unknown Source)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
... 4 more

and Here is the program


import com.googlecode.javacv.CanvasFrame;
import static com.googlecode.javacv.cpp.opencv_core.IPL_DEPTH_8U;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import static com.googlecode.javacv.cpp.opencv_core.cvCreateImage;
import static com.googlecode.javacv.cpp.opencv_core.cvGetSize;
import static com.googlecode.javacv.cpp.opencv_core.cvReleaseImage;
import static com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage;
import static com.googlecode.javacv.cpp.opencv_highgui.cvSaveImage;
import static com.googlecode.javacv.cpp.opencv_highgui.cvShowImage;
import static com.googlecode.javacv.cpp.opencv_highgui.cvWaitKey;
import static com.googlecode.javacv.cpp.opencv_imgproc.CV_BGR2GRAY;
import static com.googlecode.javacv.cpp.opencv_imgproc.CV_BGR2HSV;
import static com.googlecode.javacv.cpp.opencv_imgproc.cvCvtColor;
public class JavaCv1 {

/**
* @param args
*/
public static void main(String[] args) {
IplImage img = cvLoadImage("C:\\Users\\Deepak\\Pictures\\Hololens.jpg");
IplImage hsvimg = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,3);
IplImage grayimg = cvCreateImage(cvGetSize(img),IPL_DEPTH_8U,1);
cvCvtColor(img,hsvimg,CV_BGR2HSV);
cvCvtColor(img,grayimg,CV_BGR2GRAY);
cvShowImage("Original",img);
cvShowImage("HSV",hsvimg);
cvShowImage("GRAY",grayimg);
cvWaitKey();
cvSaveImage("Original.jpg",img);
cvSaveImage("HSV.jpg",hsvimg);
cvSaveImage("GRAY.jpg",grayimg);
cvReleaseImage(img);
cvReleaseImage(hsvimg);
cvReleaseImage(grayimg);

}

}

Few days ago it was working fine but I deleted all my Temp files then it is not working

Samuel Audet

unread,
Feb 28, 2016, 9:27:58 AM2/28/16
to jav...@googlegroups.com
On 02/21/2016 11:47 PM, Deepak Pal wrote:
> Caused by: java.lang.UnsatisfiedLinkError:
> C:\Users\Deepak\AppData\Local\Temp\javacpp4684178345609\jniopencv_highgui.dll:
> Access is denied

It looks like you've accidentally changed the permissions on your temp
folder. You'll need to fix this if you want JavaCV to work!

Samuel

Pete Helgren

unread,
Mar 1, 2016, 3:11:31 PM3/1/16
to javacv
Samuel,

Is this something that can be configured at the application level?  I am also running into this on Linux and although I know I can mount the /tmp folder as exec so the libraries can run, it is a security risk.  Any recommendations? 

Pete

Pete Helgren

unread,
Mar 2, 2016, 7:45:43 AM3/2/16
to javacv
I am going to answer my own question (since I have tested the results and it works).  Set the -Djava.io.tmpdir= to whatever folder you want, and set the correct permissions for it rather than messing with the system's temp folder (which, like I said in Linux is noexec).  

Samuel Audet

unread,
Mar 3, 2016, 8:58:12 AM3/3/16
to jav...@googlegroups.com
Actually, it's also possible to specify a cache dir with
"org.bytedeco.javacpp.cachedir":
http://bytedeco.org/javacpp/apidocs/org/bytedeco/javacpp/Loader.html#getCacheDir--

Unlike "java.io.tmpdir", that only affects JavaCPP, and you could
basically use the cache directory of your application.

Samuel

Refer

unread,
Mar 5, 2016, 8:32:24 PM3/5/16
to javacv
Please Help me I am getting the following exception when i am trying to run a simple program

following is the error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniopencv_highgui in java.library.path


 Have you added your OS jar that allows you to run opencv? An example: If you're working in windows x64 you should add the dll jar that allows run javacv, I mean, add opencv-windows-x64.jar which contains dlls for work with some methods of javacv.
Reply all
Reply to author
Forward
0 new messages