Using jni4net in a maven project

Skip to first unread message

Jinglei Ren

Aug 20, 2016, 1:05:58 PM8/20/16
to jni4net
Hi guys,

I am using jni4net in a maven project but stuck on a config issue.

I created a local repo (<repository>...<url>file:///${project.basedir}/local-maven-repo</url>...</repository>), install all jni4net lib files to it (e.g., mvn deploy:deploy-file ... -Dfile=build\jni4net.n- and specify dependencies accordingly.

Compilation is successful. But when running the program, an exception shows:
Can't load library: C:\Users\...\target\dependency\jni4net-jar-
Exception in thread "Thread-2" net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge
        at net.sf.jni4net.CLRLoader.init(
        at net.sf.jni4net.Bridge.init(
        at net.sf.jni4net.Bridge.init(

The strange thing is that the file name jni4net-jar- should never exist. There do exist both jni4net-dll- and jni4net-jar- in that dependency dir, as expected. But where does the wrong name come from in runtime? How to solve this problem?

BTW, what is the best practice to integrate jni4net to a maven project? Any guideline? I'd guess it should be one typical use scenario.


Martin Sickl

Feb 2, 2017, 1:33:57 AM2/2/17
to jni4net
hy i have the same problem did you got an solution ???

Mallikarjun patil

Jan 7, 2019, 3:40:23 AM1/7/19
to jni4net

I am facing the same issue too..
I have found out the root cause for my issue as below.
I am working with eclipse plugin and my .dll files are in a plugin but when my plugins are exported as jar files by maven build and Bridge.init() is not able to initialize using the file present in the jar file.

Any solution ?

Reply all
Reply to author
0 new messages