Sample Project (Java)

I’m coming across this error when running the sample project in Netbeans on Windows 10:

Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘C:\etBeansProjects\Java\lexactivator\win32-x86-64\LexActivator.dll’: Native library (win32-x86-64/C:\etBeansProjects\Java\lexactivator\win32-x86-64\LexActivator.dll) not found in resource path ([file:/C:/NetBeansProjects/Java/jna.jar, file:/C:/NetBeansProjects/Java/build/classes/])
at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:277)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:403)
at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:342)
at com.cryptlex.lexactivator.LexActivatorNative.GetNativeLibrary(LexActivatorNative.java:37)
at com.cryptlex.lexactivator.LexActivatorNative.(LexActivatorNative.java:43)
at com.cryptlex.lexactivator.LexActivator.SetProductFile(LexActivator.java:35)
at sample.Sample.main(Sample.java:17)
C:\Users\SHAVE UNIT\AppData\Local\etBeans\Cache\8.2\executor-snippets\run.xml:53: Java returned: 1
BUILD FAILED (total time: 0 seconds)

I’ve added the appropriate LexActivator.dll files to:
C:\etBeansProjects\Java\build\classes\lexactivator\win32-x86
C:\etBeansProjects\Java\build\classes\lexactivator\win32-x86-64
C:\etBeansProjects\Java\lexactivator\win32-x86
C:\etBeansProjects\Java\lexactivator\win32-x86-64

Sorry for the noob question. Any advise is appreciated.

Hi,
Please make \lexactivator\win32-x86 etc. folders in parallel to your jar file.

I’ve added those folders to the root of the program, but still get the same error. It seems like it’s trying to access an impossible path: win32-x86-64/C:\etBeansProjects\Java\lexactivator\win32-x86-64\LexActivator.dll

I added a few lines of code to check if the program can detect that the C:\etBeansProjects\Java\lexactivator\win32-x86\LexActivator.dll file exists in that directory and it returns true.

Are you sure you have not mixed the 32 and 64 bit dll’s? Can you try copying the exact build to target folders once again

Hello,

I am having the same problem and it is driving me nuts. Boondock, did you ever get this to work?
Thanks!

Hi,

Did you install the VS2015 runtime as instructed in the tutorial?

Regards,
Adnan

Hi adnan,

I am using IntelliJ and trying to figure out how to load the .dll. Sorry, I am kind of noob with this. At this point I have:
1.) downloaded the LexActivator for Windows
2.) downloaded the .dat file
3.) downloaded the file from GitHub

Now, just to make sure I can get this to work, I opened the sample project in IntelliJ, copied the appropriate .dll file into the win31-x86-64 folder, and tried to run the first line of code indicated in the “Using LexActivator with Java” tutorial. The line of code is

LexActivator.SetProductData(“PASTE_CONTENT_OF_PRODUCT.DAT_FILE”);

This produces the compile error:
Exception in thread “main” java.lang.UnsatisfiedLinkError: Unable to load library ‘C:\Users\Jim\Desktop\LexActivator\lexactivator\win32-x86-64\LexActivator.dll’: Native library . . . .

Any advice you have to offer would be greatly appreciated! Thanks

The reason could be that the dependency library of LexActivator.dll is not present on your system. So, even if LexActivator.dll is present at the correct location it still fails to load.

The Java tutorial has a link to download the dependency libraries of LexActivator - VS2015 runtimes. Install 32 bit as well as 64 versions of the VS2015 runtime.

Forgive me, but where is the tutorial you are talking about?

Please refer to the following:

https://docs.cryptlex.com/node-locked-licenses/using-lexactivator/using-lexactivator-with-java#adding-library-to-your-app