这是错误信息F:\设计\ReConserver\classes\reconserver>javah testdll
错误: 无法访问 testdll
找不到文件 testdll.class
javadoc: 错误 - 找不到类 testdll。
Error: 未在命令行中指定任何类。请尝试使用 -help。这是testdll.java内容:package reconserver;public class testdll {
static{
try{
System.loadLibrary("System");
}catch(Exception e){}
}
public native static String newprocess(String s);
public native static String killprocess(String s);
public native static void poweroff();
public native static void restart();}
错误: 无法访问 testdll
找不到文件 testdll.class
javadoc: 错误 - 找不到类 testdll。
Error: 未在命令行中指定任何类。请尝试使用 -help。这是testdll.java内容:package reconserver;public class testdll {
static{
try{
System.loadLibrary("System");
}catch(Exception e){}
}
public native static String newprocess(String s);
public native static String killprocess(String s);
public native static void poweroff();
public native static void restart();}
解决方案 »
- GUI编程出乎意料,请高手指点
- 简单的计算器程序 帮改一下啊!!
- 一个关于继承的问题
- 高分求21cn的面试题目,java工程师的,有那位大哥大姐去面试过的,可以把题目贴上来吗????万分感谢!!!
- java 有没有像C++的XML/C++ binding产品exerces 类似的产品?
- Java源程序中包括多个类,编译之后为什么不产生多个.class文件?
- byte怎么进行位运算阿
- java返回匿名类的问题
- 从JButton继承的组件,怎么在FlowLayout布局中正确显示大小呢?
- 在JBuilder中如何创建一个标题在左侧输入格在右侧的表格?
- Java文件操作怎样写入回车符
- JPanel使用GridLayout布局不能显示panel中加入的标签?
错误: 无法访问 testdll
找不到文件 testdll.class
==========================================================
在用jni调用用户类的时候,要么指定路径,要么该类位于classpath所指定的路径目录下,
也就是说你的testdll是否能直接利用classpath找到
set classpath=.;%classpath%
javah reconserver.testdll
然后再用javah从.class中生成.h
记住:必须在目录F:\设计\ReConserver\classes下。
我执行好用了,下面是得到的头文件,文件名是:reconserver_TestDLL.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class reconserver_TestDLL */#ifndef _Included_reconserver_TestDLL
#define _Included_reconserver_TestDLL
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: reconserver_TestDLL
* Method: newprocess
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_reconserver_TestDLL_newprocess
(JNIEnv *, jclass, jstring);/*
* Class: reconserver_TestDLL
* Method: killprocess
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_reconserver_TestDLL_killprocess
(JNIEnv *, jclass, jstring);/*
* Class: reconserver_TestDLL
* Method: poweroff
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_reconserver_TestDLL_poweroff
(JNIEnv *, jclass);/*
* Class: reconserver_TestDLL
* Method: restart
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_reconserver_TestDLL_restart
(JNIEnv *, jclass);#ifdef __cplusplus
}
#endif
#endif
这个正解
F:\设计\ReConserver\classes>javah reconserver.testdll