我正在尝试动态加载类org.jawin.FuncPtr Jawin:http://jawinproject.sourceforge.net/ 不幸的是我收到了这个错误: java.lang.ClassFormatError:类文件org / jawin / FuncPtr中常量池中的非法UTF8字符串
我正在使用这个课程:
/*
* HelloDll.java -
*
* This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
*
* Please consult the LICENSE file in the project root directory,
* or at the project site before using this software.
*/
/* $Id: HelloDll.java,v 1.3 2004/06/14 20:16:38 arosii_moa Exp $ */
package demos;
import org.jawin.COMException;
import org.jawin.FuncPtr;
import org.jawin.ReturnFlags;
/**
* Demo that uses the Win32 MessageBoxW API-method.
*
* @version $Revision: 1.3 $
* @author Stuart Halloway, http://www.relevancellc.com/halloway/weblog/
*/
public class HelloDll {
public static void main(String[] args) throws Exception {
FuncPtr msgBox = null;
try {
msgBox = new FuncPtr("USER32.DLL", "MessageBoxW");
msgBox.invoke_I(0, "Hello From a DLL", "From Jawin", 0, ReturnFlags.CHECK_FALSE);
} catch (COMException e) {
// handle exception
e.printStackTrace();
throw e;
} finally {
if (msgBox != null) {
try {
msgBox.close();
} catch (COMException e) {
// handle fatal exception
e.printStackTrace();
throw e;
}
}
}
}
}
我用defineClass动态加载它 如果我将HelloDll类更改为不使用Jawin,而只是打印“Hello World”,则不会抛出错误并且代码运行流畅,所以我假设类加载器没有任何问题[?]
我如何弄清楚为什么会收到此错误?