2

I'm trying to create JNI headers from a Java class using javah in eclipse . I created a Program in External Tools(Run -> External Tools -> External Tools Configuraitons) with these configurations :
Location : ${env_var:JAVA_HOME}\bin\javah.exe
Working Directory : ${workspace_loc:/MyProject/bin/classes}
Arguments : -jni -verbose -d "${project_loc}${system_property:file.separator}jni" ${java_type_name}
But when I run it this error occurs :

The selected resource does not resolve to a Java element

How can I fix this error?
Thanks!

s4eed
  • 7,173
  • 9
  • 67
  • 104

2 Answers2

1

I used this in my Arguments and my problem went away :

-d ${project_loc:}/jni -classpath E:\Android\adt-bundle-windows-x86_64\sdk\platforms\android-14\android.jar;${project_loc}/bin/classes com.example.myreallyjniproject.MainActivity
Bobby-Z
  • 44
  • 6
s4eed
  • 7,173
  • 9
  • 67
  • 104
1

I just faced the same problem, notice that your fix is not really ideal, as you replaced "${java_type_name}" with a hard coded class name. This configuration won't work for multiple java files or other classes.

In order for the "${java_type_name}" variable to work, you have to select a java file in eclipse and then you run the javah eclipse configuration or it works when you save a given java file.

Instead of calling javah directly, I ended up creating an ant script for dealing with the multiple classes that I have and configuring that ant script within the Project Builder settings.

eTHP
  • 81
  • 2