I suspect the issue is that your class has a package and you are trying to run the command from the directory with the class file instead of the package root.
Samhain's example works because his MyClass.java
contains no package, whereas I suspect yours does.
For example, assume we have the following file at c:srccomexampleMyClass.java
package com.example;
public class MyClass {
public native void myMethod();
}
Go to the command line and execute the following:
c:srccomexample>javac MyClass.java
c:srccomexample>dir
Directory of C:srccomexample
2015-02-23 03:17 PM <DIR> .
2015-02-23 03:17 PM <DIR> ..
2015-02-23 03:20 PM 219 MyClass.class
2015-02-23 03:17 PM 84 MyClass.java
c:srccomexample>javah MyClass
Error: Could not find class file for 'MyClass'.
c:srccomexample>cd c:src
c:src>javah com.example.MyClass
c:src>dir
Directory of C:src
2015-02-23 03:18 PM <DIR> .
2015-02-23 03:18 PM <DIR> ..
2015-02-23 03:16 PM <DIR> com
2015-02-23 03:18 PM 449 com_example_MyClass.h
Success!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…