Im learning to code Android in NDK on WINDOWS Eclipse.... been following a Tutorial Book by Sylvain Ratabouil. So im in Run | External Tools | External Tools Configurations… creating a new program configuration.
我学习在WINDOWS Eclipse中的代码Android NDK ....一直在阅读西尔瓦恩·拉塔布尔的教程。因此,我正在运行|外部工具|外部工具配置……创建一个新的程序配置。
Name: MyProject javah
名称:MyProject javah
Location : ${env_var:JAVA_HOME}\bin\javah.exe
地点:$ { env_var:JAVA_HOME } \ bin \ javah.exe
Working directory: ${workspace_loc:/MyProject/bin}
工作目录:$ { workspace_loc:/ MyProject / bin }
The problem comes In arguments... when i try Arguments: –d ${workspace_loc:/MyProject/jni} com.myproject.MyActivity as it says in the book
问题来自争论……当我尝试参数:-d ${workspace_loc:/MyProject/jni} com.myproject。就像书中说的那样
i get when i click run
当我点击运行时
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: –d
when i try ${workspace_loc:/MyProject/jni} com.myproject.MyActivity}
当我尝试${workspace_loc:/MyProject/jni} com.myproject.MyActivity}时
i get
我得到
Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: C:\Paul\Workspace\MyProject\jni
UPDATE: i put -classpath first and it's running but can not find the class file for com.myproject
更新:我把-classpath放在前面,它正在运行,但是找不到com.myproject的类文件
6 个解决方案
#1
5
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
-d ${workspace_loc:/MyProject/jni} -classpath C:\Paul\android-sdk-windows平台\android-17\ androidis .jar;${workspace_loc:/MyProject/bin/classes} . myproject.mainactivity
#2
1
I also spend some long time on this problem when working with the the mentioned book about Android NDK.
我在使用提到的关于Android NDK的书时,也花了很长时间来研究这个问题。
Please note the following: The java classname is NOT written in { }
, just write something like com.myproject.MyActivity
请注意以下内容:java classname不是用{}写的,而是写一些类似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.)
(顺便说一句。:正确的Adroid。jar文件在Eclipse项目中被引用。
#3
1
Me also facing the same problem tonight, i found a less tedious way as following...
今晚我也面临着同样的问题,我找到了一种不那么乏味的方式。
- as "Location" set the javah from your system
- 作为“位置”,从系统中设置javah
- as "Working directory" set the project's bin/classes directory (${workspace_loc:/HelloWorld/bin/classes})
- 作为“工作目录”,设置项目的bin/classes目录(${workspace_loc:/HelloWorld/bin/classes})
- 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)
- 作为“参数”,将jni文件夹设置为输出目录,并指出要运行java的类(-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}")
NB:不要忘记第三步中输出的双qoute ("${workspace_loc:/HelloWorld/jni}")
A full picture is also attached following
全文如下
#4
0
well in case ...
在情况下……
1-> Goto ( cd C:\Program Files\Java\jdk1.7.0_60\bin)
1 - >转到(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
2 - > C:\Program Files\Java\ jdk1.7.0_60 \ bin > javah jni classpath F:\ Android_OpenGLES \ FibonacciNative \ bin \类F - d:\ Android_OpenGLES \ FibonacciNative \ jni \ com.example.fibonaccinative.FibLib
without creating/using environment variable ...
没有创建/使用环境变量…
#5
0
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
如果没有找到作为命令的javah,您将得到
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
.
使用jdk路径的直接路径,在我的例子中是/usr/lib/jvm/jdk1.8.0/bin/ javahah。
#6
0
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
#1
5
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
-d ${workspace_loc:/MyProject/jni} -classpath C:\Paul\android-sdk-windows平台\android-17\ androidis .jar;${workspace_loc:/MyProject/bin/classes} . myproject.mainactivity
#2
1
I also spend some long time on this problem when working with the the mentioned book about Android NDK.
我在使用提到的关于Android NDK的书时,也花了很长时间来研究这个问题。
Please note the following: The java classname is NOT written in { }
, just write something like com.myproject.MyActivity
请注意以下内容:java classname不是用{}写的,而是写一些类似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.)
(顺便说一句。:正确的Adroid。jar文件在Eclipse项目中被引用。
#3
1
Me also facing the same problem tonight, i found a less tedious way as following...
今晚我也面临着同样的问题,我找到了一种不那么乏味的方式。
- as "Location" set the javah from your system
- 作为“位置”,从系统中设置javah
- as "Working directory" set the project's bin/classes directory (${workspace_loc:/HelloWorld/bin/classes})
- 作为“工作目录”,设置项目的bin/classes目录(${workspace_loc:/HelloWorld/bin/classes})
- 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)
- 作为“参数”,将jni文件夹设置为输出目录,并指出要运行java的类(-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}")
NB:不要忘记第三步中输出的双qoute ("${workspace_loc:/HelloWorld/jni}")
A full picture is also attached following
全文如下
#4
0
well in case ...
在情况下……
1-> Goto ( cd C:\Program Files\Java\jdk1.7.0_60\bin)
1 - >转到(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
2 - > C:\Program Files\Java\ jdk1.7.0_60 \ bin > javah jni classpath F:\ Android_OpenGLES \ FibonacciNative \ bin \类F - d:\ Android_OpenGLES \ FibonacciNative \ jni \ com.example.fibonaccinative.FibLib
without creating/using environment variable ...
没有创建/使用环境变量…
#5
0
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
如果没有找到作为命令的javah,您将得到
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
.
使用jdk路径的直接路径,在我的例子中是/usr/lib/jvm/jdk1.8.0/bin/ javahah。
#6
0
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