Java调用第三方dll文件的使用方法
public class OtherAdapter { static { //System.loadLibrary("Connector");//载入需要调用的dll Connector.dll System.load("d://Connector.dll");//载入dll Connector.dll } //用native关键字修饰将被其它语言实现的方法 //dll文件中对应的函数声明 public native static int _PWLogon(String lpszDS,String lpszUser,String lpszPWD); //函数声明 public native static void _PWLogout(); public native static String _GetPWLastError(); public native static String _GetPWFolders(long lParentFolderno); public native static String _GetPWDocuments(long lFolderno); public native static String _GetPWFiles(long lFolderno,long lDocno); //public native static String pirntStr(String msg);//函数声明 public static void main(String[] args){ //本地方法的调用 int rs=_PWLogon("服务器","账号","密码"); System.out.println("用户登录状态:"+rs); if(rs==1) { System.out.println("获取顶级目录:"+_GetPWFolders(0)); System.out.println("获取父子目录:"+_GetPWDocuments(54)); System.out.println("下载指定文件:"+_GetPWFiles(54,2)); _PWLogout(); } else { System.out.println("获取错误信息:"+_GetPWLastError()); } } }