java.lang.IllegalArgumentException: Not a valid class name: ANDROID NDK javah

拟墨画扇 提交于 2019-12-04 04:47:36

after further research.... i did it.

i set arguments to

-d ${workspace_loc:/MyProject/jni} -classpath C:\Paul\android-sdk-windows\platforms\android-17\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MainActivity

Julian

I also spend some long time on this problem when working with the the mentioned book about Android NDK.

Please note the following: The java classname is NOT written in { }, just write something like com.myproject.MyActivity

The -classpath parameter can receive several paths devided by semicolon.

In my case this parameters worked:

Location:

${env_var:JAVA_HOME}\bin\javah.exe

Working Directory:

${workspace_loc:/myproject/bin}

Arguments:

-d ${workspace_loc:/myproject/jni} -classpath ${workspace_loc:/myproject/bin/classes};"C:\Eclipse\sdk\platforms\android-18\android.jar" com.myproject.MyActivity

(BTW.: The correct Adroid.jar file is referenced inside the Eclipse project.)

Me also facing the same problem tonight, i found a less tedious way as following...

  1. as "Location" set the javah from your system
  2. as "Working directory" set the project's bin/classes directory (${workspace_loc:/HelloWorld/bin/classes})
  3. as "Argument" set the jni folder as the output directory and point out the class on which you want to run the javah (-d "${workspace_loc:/HelloWorld/jni}" com.example.helloworld.MainActivity)

NB :: Dont forget the double qoute (") around the output in the third step ("${workspace_loc:/HelloWorld/jni}")

A full picture is also attached following

well in case ...

1-> Goto ( cd C:\Program Files\Java\jdk1.7.0_60\bin)

2-> C:\Program Files\Java\jdk1.7.0_60\bin>javah -jni -classpath F:\Android_OpenGLES\FibonacciNative\bin\classes -d F:\Android_OpenGLES\FibonacciNative\jni\ com.example.fibonaccinative.FibLib

without creating/using environment variable ...

Following I tried successfully

javah com.sense.kios.Calculation

Note: Include package name.

In case if javah not found as an command and you getting

The program 'javah' can be found in the following packages:
 * gcj-4.6-jdk
 * gcj-4.7-jdk
 * openjdk-7-jdk
 * openjdk-6-jdk
Try: sudo apt-get install <selected package>

use direct path of jdk path, in my case it's /usr/lib/jvm/jdk1.8.0/bin/javah.

Dhiraj Himani

YES THAT'S CORRECT more abstract would be

-d ${workspace_loc:/MyProject/jni} -classpath ${env_var:ANDROID_SDK_HOME}\platforms\android-16\android.jar;${workspace_loc:/MyProject/bin/classes} com.myproject.MyActivity
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!