我用了用了System.loadlibrary("dllname")之后,因为程序还有点错,所以程序就出事了
出现了如下错误:
Cound not bind socket.Address and port are already use.此错误,我想是因为没有释放Dll的资源使Dll驻留系统内存,而出现IP和端口占用的情况,因为那个Dll会绑定IP和端口
出现了如下错误:
Cound not bind socket.Address and port are already use.此错误,我想是因为没有释放Dll的资源使Dll驻留系统内存,而出现IP和端口占用的情况,因为那个Dll会绑定IP和端口
private static final EmsService mInstance = new EmsService(); protected final String DLL_NAME = "EsmApi"; private EmsService() {
InitialDll();
} public static EmsService getInstance() {
return mInstance;
} private void InitialDll() {
try {
System.loadLibrary(DLL_NAME);
} catch (Exception e) {
System.out.println("----------------发生异常开始--------------");
e.printStackTrace();
System.out.println("----------------发生异常结束--------------");
} finally {
System.out.println("Loading : " + DLL_NAME + ".dll");
}
}public native int LogintoEsm(String CorpId,String UserId,String Password);
}
是的,因为第一次运行程序的时候占用了这个端口,所以当我第二次再启动的时候它已经在内存中了