Skip to content

Commit 29b763d

Browse files
author
Andrey Pavlenko
committed
updating samples to load JNI lib with correct suffix
1 parent 5321da9 commit 29b763d

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

samples/java/ant/src/SimpleSample.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import org.opencv.core.Core;
12
import org.opencv.core.Mat;
23
import org.opencv.core.CvType;
34
import org.opencv.core.Scalar;
45

56
class SimpleSample {
67

7-
static{ System.loadLibrary("opencv_java244"); }
8+
static{ System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX); }
89

910
public static void main(String[] args) {
11+
System.out.println("Welcome to OpenCV " + Core.VERSION);
1012
Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
1113
System.out.println("OpenCV Mat: " + m);
1214
Mat mr1 = m.row(1);

samples/java/eclipse/HelloCV/src/Main.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
import org.opencv.core.Core;
12
import org.opencv.core.CvType;
23
import org.opencv.core.Mat;
34

45
public class Main {
56

67
public static void main(String[] args) {
7-
System.loadLibrary("opencv_java244");
8+
System.out.println("Welcome to OpenCV " + Core.VERSION);
9+
System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX);
810
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
911
System.out.println("m = " + m.dump());
1012
}

samples/java/sbt/src/main/scala/Main.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,14 @@
88
* You're invited to submit your own examples, in any JVM language of
99
* your choosing so long as you can get them to build.
1010
*/
11+
12+
import org.opencv.core.Core
13+
1114
object Main extends App {
1215
// We must load the native library before using any OpenCV functions.
1316
// You must load this library _exactly once_ per Java invocation.
1417
// If you load it more than once, you will get a java.lang.UnsatisfiedLinkError.
15-
System.loadLibrary("opencv_java")
18+
System.loadLibrary("opencv_java" + Core.VERSION_SUFFIX)
1619

1720
ScalaCorrespondenceMatchingDemo.run()
1821
ScalaDetectFaceDemo.run()

0 commit comments

Comments
 (0)