0

When i generating header file with JNI using 'javah' it shows

Error: Class org.opencv.core.Mat could not be found.

System: Mac OSX

Using: Android Studio and opencv 3.1 for android

Commandline:

javah -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar:. com.lumenghz.test.OpencvHelper

Who can help me?

Edit-1 I also tried

javah -d ~/Documents/androidworkspace/RumenTest/test/src/main/jni -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar:. com.lumenghz.test.OpencvHelper

But still got the same error:

Error: Class org.opencv.core.Mat could not be found.
Dennis Lu
  • 762
  • 2
  • 9
  • 21

2 Answers2

1

You are giving wrong class path here:

com.lumenghz.test.OpencvHelper

Give full class path like this:

~/Documents/androidworkspace/RumenTest/openCVLibrary310/build/intermediates/classes/debug:. com.lumenghz.test.OpencvHelper

  javah -d (JNI Folder Location) -classpath (JAR Locaion);(class Path)

example as per your paths-

 javah -d ~/Documents/androidworkspace/RumenTest/test/src/main/jni -classpath /Users/lumeng/Library/Android/sdk/platforms/android-23/android.jar;~/Documents/androidworkspace/RumenTest/openCVLibrary310/build/intermediates/classes/debug: com.lumenghz.test.OpencvHelper
Jonathan
  • 6,507
  • 5
  • 37
  • 47
Pankaj Malviya
  • 109
  • 1
  • 3
  • Thanks for your reply, it's working :-) And the command i posted is also worked. – Dennis Lu Sep 01 '16 at 07:17
  • I use same command this command :- `javah -classpath D:\Android_sdk\platforms\android-23\android.jar;. com.v1.v1golf2.library.CaptureVideo3` but getting some error : -Error: `Could not find class file for 'com.v1.v1golf2.library.CaptureVideo3`'. – Anand Jain Jul 17 '19 at 13:01
0

Solved

I should declare the classpath of opencv-sdk-android which been builded.

So the commandLine should be like this:

javah -classpath ~/Documents/androidworkspace/RumenTest/openCVLibrary310/build/intermediates/classes/debug:. com.lumenghz.test.OpencvHelper
Dennis Lu
  • 762
  • 2
  • 9
  • 21
  • I use same command this command :- `javah -classpath D:\Android_sdk\platforms\android-23\android.jar;. com.v1.v1golf2.library.CaptureVideo3` but getting some error : -Error: `Could not find class file for 'com.v1.v1golf2.library.CaptureVideo3`'. – Anand Jain Jul 17 '19 at 13:04