Running java with opencv on a colibri imx6

Hello,

So, I am very new to programming for embedded devices, and have never done so for a toradex device before. For my project I am writing a gui interface in java, which needs to be able to take pictures with a webcam using opencv. I got this code all compiles and run on my host machine, but Am running into problems trying to run it on the imx6. I have the correct version of java installed, and I tried copying over just the class file, as well as the whole jar after exporting it from intellij. I also coppied the opencv-400.jar over to the toradex device. Is this all I need? and if so, how do I call it then so It knows where everything is? and if not, what sort of configuring of my environment do I still need to do? In the past I have always had an IDE to compile and run my java code.

Thank you for your help.

hi

I got this code all compiles and run on my host machine, but Am running into problems trying to run it on the imx6.

What kind of Problem?

Is this all I need? and if so, how do I call it then so It knows where everything is? and if not, what sort of configuring of my environment do I still need to do? In the past I have always had an IDE to compile and run my java code.

To run java with opencv, you would need to install a custom image on the module with opencv and java included. Have you done this?

Best regards, Jaski

Thank you for your comment, It is a linking problem I am having. I have java installed, I did not build a custom image, and that really isn’t an option, but I have java in the opt directory and the path variable set so java is recognized. I was not sure if I needed to do a full instilation of opencv on the imx6 just to run my dode, I thought having the opencv.jar file was enough. Lastly I have never run java code on the command line before, always in an IDE. I have looked up information about specifying the classpath with -cp, and using -Djava.library.path, but when I do so and point the library path to the jar it still throws errors about not recognizing the classes from opencv. Speficifally java.lang.noclassdeffounderror.

If you need any more information i’ll do my best to provide it, but I have never worked in this sort of environment before, and at my job there isn’t a single other person who can even comprehend what a programming language is.

I was not sure if I needed to do a full instilation of opencv on the imx6 just to run my dode, I thought having the opencv.jar file was enough.

Does the java code run on the host, when you just provide the opencv.jar?

Actually you need to create the same environment as you are using it on the host. Is the only problem opencv? Is the rest of java code running on the module?

It is running on the host in the ide, I had not gotten it to run on the command line even on the host.

I have gotten other java code to run on the toradex device, If it is not dependant upon any external libraries or resources

hi @LTorg

Could you try these commands to compile java with external libraries on your host and the module ?