Search code examples
eclipsesqliteeclipse-pluginjava-native-interfaceklocwork

Klocwork plugin failed to run in eclipse with error "java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path"


I just installed Klocwork plugin for Eclipse. But when I start to scan a project, it gives me the following error:

java.lang.UnsatisfiedLinkError: no sqlite_jni in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.klocwork.desktopdb.SqliteJniLoader.initDefaultLibraries(SqliteJniLoader.java:28)
    at com.klocwork.desktopdb.SqliteAgent.<clinit>(SqliteAgent.java:21)
    at com.klocwork.desktopdb.migration.MigrateDesktopDb.<init>(MigrateDesktopDb.java:48)
    at com.klocwork.desktopdb.migration.MigrateDesktopDb.migrate(MigrateDesktopDb.java:44)
    at com.klocwork.desktopdb.KwlpProblemsStorageUtil.migrateOrCreateStorage(KwlpProblemsStorageUtil.java:32)
    at com.klocwork.kwcheck.commands.AbstractCommand.convertToDB(AbstractCommand.java:82)
    at com.klocwork.kwcheck.commands.BuildCommand.execute(BuildCommand.java:110)
    at com.klocwork.util.CommandLineParser2.parse(CommandLineParser2.java:360)
    at com.klocwork.kwcheck.KwCheckMain.main(KwCheckMain.java:22)
kwcheck: WARNING: Exception occured in java application
Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.library.path=".;C:\Program Files (x86)\myLib\win32"
Exception in thread "main" 

I found several threads with similar issues:

http://thelogofthewook.blogspot.de/2011/12/updating-problems-myproject-no.html

https://developer.klocwork.com/community/forums/klocwork-general/user-tools/eclipse-plugin-error

They all mentioned some 32bit/64bit issue. But I am using 32bit Eclipse + 32bit JVM.

And as I checked, there are 2 different sqlite_jni.dll files existing in the plugin's lib and lib64 folders respectively. So I guess no file is missing.

So what could be wrong?

Currently, I am trying to troubleshoot it in the following ways:

  1. Figure out how a plugin locates its native libraries.
  2. How to configure java.library.path for a plugin.

Solution

  • A little patience pays off...

    I read carefully the error message and it clearly says:

    Picked up _JAVA_OPTIONS: -Djava.net.preferIPv4Stack=true -Djava.library.path=".;C:\Program Files (x86)\myLib\win32"

    So I suddenly recall that I once set a environmental variable like this:

    _JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true -Djava.library.path=".;C:\Program Files (x86)\myLib\win32"

    After I changed it to below, things begin to work.

    _JAVA_OPTIONS = -Djava.net.preferIPv4Stack=true

    And some background reference: http://examples.javacodegeeks.com/java-basics/java-library-path-what-is-it-and-how-to-use/