-3

My computer is always on and for a few months it promted me to update from win7 to win10. I always declined but one morning I found my computer updated and with a new problem.

I have a few java projects that were working fine on win7 and now I can't use a DLL, the error is "java.lang.UnsatisfiedLinkError: Unable to load library 'CidGen64.dll': The specified module could not be found".

The problem appears only in NetBeans, when I run the application with JRE it works fine. I tried to change the libpath like this but the error is the same.

System.setProperty("java.library.path", LibPath);

UPDATE1: This is not a duplicate, I applied the steps from the supposed duplicate and is not working. It is a windows 10 <-> Netbeans or JDK problem.

UPDATE2: I posted a NetBeans project that works in XP(I have no more win7) and fails in windows 10. The project is here

Victorqedu
  • 484
  • 4
  • 20
  • This is a java programming question. I work in NetBeans. This code was working until I updated to windows 10. I tried to set libpath from java code and with "java -Djava.library.path=". I checked that libpath is correct with "System.err.println("LibPath1 "+System.getProperty("java.library.path"));" and this show the directory where the DLL is. Only JDK is affected by this problem. The I run the application in JRE is fine. – Victorqedu Jun 20 '16 at 08:09
  • This is not a duplicate, I applied the steps from the supposed duplicate and is not working. It is a windows 10 <-> Netbeans or JDK problem. Seting java.library.path from code should work also. – Victorqedu Jun 20 '16 at 08:14

1 Answers1

1

Lets start with what the problem is not. It is NOT that Java programs with DLLs don't work on Windows 10. That is implausible. If it was actually true, the screams would have gone around the planet thousands of times by now.

To me, there are two plausible explanations:

  1. Your JDK and/or Netbeans installations have been borked by the upgrade. Solution: uninstall both, download the latest copies and reinstall.

  2. Somehow you are not specifying the library path correctly. For instance, you say that you "have checked that the libpath is correct"... but you haven't actually told us what it is. (I can think of 3 non-obvious ways that it could be wrong.)


Another possibility is that it is a 32bit JVM versus 64bit DLL issue. However, this doesn't fit the evidence you have presented. Ditto for some issue with file permissions.


Setting java.library.path from code should work also

That depends on:

  1. you setting the correct library path, and
  2. the setProperty call happening soon enough.

Finally, if you add -verbose:jni to the java command, it should tell you where it loads native libraries from and (I think) give you more information when a library load fails.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216