RishiGupta12 / SerialPundit

Serial port communication in Java - FTDI D2XX, HID API, X/Y modem
GNU Affero General Public License v3.0
125 stars 56 forks source link

Application Crash when starting multiple instance of java file. #44

Open umerdhamria1 opened 3 years ago

umerdhamria1 commented 3 years ago

Thanks for the great library, I am facing problem in running two instance on a single machine with different com port, application is generating error com.serialpundit.core.SerialComException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:393) at com.serialpundit.serial.SerialComManager.(SerialComManager.java:382) at ecibautomatebs.ECIBFetchCNIC.Port(ECIBFetchCNIC.java:31) at ecibautomatebs.ECIBFetchCNIC.FetchCNIC(ECIBFetchCNIC.java:98) at ecibautomatebs.ECIBFetchCNIC.main(ECIBFetchCNIC.java:52) Caused by: com.serialpundit.core.SerialComException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:355) ... 4 more Caused by: java.io.FileNotFoundException: C:\Windows\TEMP\sp_tuartx1\spcomwinx64.dll (The process cannot access the file because it is being used by another process) at java.io.FileOutputStream.open0(Native Method) at java.io.FileOutputStream.open(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at java.io.FileOutputStream.(Unknown Source) at com.serialpundit.serial.internal.SerialComPortJNIBridge.loadNativeLibrary(SerialComPortJNIBridge.java:335)

Please suggest how can i get off of this error. My limitation is to use single machine as send and receiver with continuous running service.

Thanks

RishiGupta12 commented 3 years ago

Please use different names for native libraries when creating SerialComManager instance. Documentation (Javadocs) have all the info.