Quote:
Originally Posted by DaPasta
Greetings!
I attempted to get OpenCV working with Java. However, once I pushed the Java code to the roboRio, I get the following error on the driver station:
Code:
ERROR Unhandled exception: java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path at [java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857), java.lang.Runtime.loadLibrary0(Runtime.java:870), java.lang.System.loadLibrary(System.java:1119), org.team1515.pastabot.Robot.robotInit(Robot.java:41), edu.wpi.first.wpilibj.IterativeRobot.startCompetition(IterativeRobot.java:76), edu.wpi.first.wpilibj.RobotBase.main(RobotBase.java:234)]
I also added the following line in the roboInit method per instructions based on a previous post:
Code:
System.load("/usr/local/lib/lib_OpenCV/java/opencv_java2410.so");
I double checked multiple times that this path was correct.
|
This may be due to the robotInit() method being called a short period of time after the robot code actually starts.
You can put the System.load(PATH); line inside of a static initialization block in the main robot class.
It should look something like this, but with CV_PATH replaced by the path you installed to. It can be inserted above your robotInit() method.
Code:
static {
System.load(CV_PATH);
}