0

I've put together a program, and one of the methods uses Jacob. While I was working on the program in the compiler, I could only get the Jacob library to work if I put the jacob-1.18-x64.dll file in the same folder as the project that I was working on. This worked fine, until I tried to wrap the program into a .exe file using Launch4j. When I click the .exe version of the program, it t throws a Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob-1.18-x64 in java.library.path error when it gets to the method that uses Jacob. I know the issue is because it can't find the library, but I'm not sure as to how to get this library connected to the .exe file. How do I get this .exe file to run and include the Jacob libraries? As I mentioned earlier, in order to get the program to work in the IDE, I had to move the .dll to the same folder as the project. As a result, I tried doing the same thing with the .exe file, but even when in the same folder, it doesn't work. What else do I need to do in order to get this working?

Jcmoney1010
  • 912
  • 7
  • 18
  • 41

2 Answers2

0

You must set java.library.path on the JVM's command line, something like this:

java -Djava.library.path=jacob-1.18-x64.dll -cp your_class path YourMainClass

I suggest to first figure out to run like this from the command line, and then find out how to convert your fully working command line correctly to Launch4j.

janos
  • 120,954
  • 29
  • 226
  • 236
0

Jacob v1.18 invoke System.loadLibrary(dllname) to load DLL file. The search rule is based on system property java.library.path (Be careful, change it after JVM launched is useless)

You can check this answer about changing Launch4j configuration

Community
  • 1
  • 1
Beck Yang
  • 3,004
  • 2
  • 21
  • 26