1

I have a Java program that is executed normally via the terminal. However, when I try to execute it via another python code and more specifically via the os.system() or subprocess.run() functions, I get the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.slytechs.library.NativeLibrary.dlopen(Ljava/lang/String;)J
at com.slytechs.library.NativeLibrary.dlopen(Native Method)
at com.slytechs.library.NativeLibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.<init>(Unknown Source)
at com.slytechs.library.JNILibrary.loadLibrary(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at com.slytechs.library.JNILibrary.register(Unknown Source)
at org.jnetpcap.Pcap.<clinit>(Unknown Source)
at cic.cs.unb.ca.jnetpcap.PacketReader.config(PacketReader.java:58)
at cic.cs.unb.ca.jnetpcap.PacketReader.<init>(PacketReader.java:52)
at cic.cs.unb.ca.ifm.Cmd.readPcapFile(Cmd.java:128)
at cic.cs.unb.ca.ifm.Cmd.readPcapDir(Cmd.java:100)
at cic.cs.unb.ca.ifm.Cmd.main(Cmd.java:73)
TCP/IP Features were extracted to: /CICFlowMeter/bin/

To execute the java program, I am using the following command:

   subprocess.run( ["/home/user/PycharmProjects/untitled/CICFlowMeter/bin/cfm", "/home/user/PycharmProjects/untitled/CICFlowMeter/bin/", "/home/user/PycharmProjects/untitled/CICFlowMeter/bin/"])

The java program is named cfm and take two parameters as input and particularly the path of two directories. cfm is the CICFlowmeter:

https://github.com/ISCX/CICFlowMeter

Based on the instructions provided by the above GitHub page in order to execute Cicflowmeter I need to install only the libpcap-dev library.

Any idea please?

Panagiotis
  • 511
  • 8
  • 26
  • How are you trying to execute the Java code via Python? – felipe Jul 21 '19 at 12:08
  • https://examples.javacodegeeks.com/java-basics/exceptions/java-lang-unsatisfiedlinkerror-how-to-handle-unsatisfied-link-error/ The libraries your Java program is using are not loading correctly when called via Python. The HOW you are loading the program via Python is what we need to know to be able to help. – felipe Jul 21 '19 at 12:10
  • @FelipeFaria thank you very match for your comments, I have edited my question based on your comments – Panagiotis Jul 21 '19 at 12:19

0 Answers0