M. Usman Khan
M. Usman Khan

Reputation: 4448

Android Studio javah not a valid class name

I was working on book "Chapter-3-Communicating-with-Native-Code-Using-JNI.pdf". There when I tried to create header files using javah command I get the error:

Exception in thread "main" java.lang.IllegalArgumentException: Not a valid class name: ?classpath

I tried the instruction in terminal:

javah –classpath bin/classes com.example.hellojni.HelloJni

But i see that this is for Eclipse paths and I am using Android Studio. So I tried this:

..helloJni\app>javah -d jni –classpath build\intermediates\classes\arm7\debug com.example.hellojni.HelloJni

I have HelloJni.class file in "helloJni\app\build\intermediates\classes\arm7\debug\com\example\hellojni". I am still getting the same error and I am surprised that I couldn't find a direct solution on stackoverflow. Can you help me with this?

Upvotes: 0

Views: 1066

Answers (1)

user2543253
user2543253

Reputation: 2173

Did you copy the -classpath argument from somewhere? Your error message indicates that javah thinks -classpath is the class name. And as it shows ?classpath in the output, it seems the - is not what you think is, but some special character. Try typing -classpath yourself.

Edit: was curious. What you have instead of - is an –

Upvotes: 1

Related Questions