Using jni4net in a maven project

364 views
Skip to first unread message

Jinglei Ren

unread,
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-0.8.8.0.dll) 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-0.8.8.0.dll
Exception in thread "Thread-2" net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge
        at net.sf.jni4net.CLRLoader.init(CLRLoader.java:45)
        at net.sf.jni4net.Bridge.init(Bridge.java:35)
        at net.sf.jni4net.Bridge.init(Bridge.java:31)

The strange thing is that the file name jni4net-jar-0.8.8.0.dll should never exist. There do exist both jni4net-dll-0.8.8.0.dll and jni4net-jar-0.8.8.0.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.

Thanks,
Jinglei

Martin Sickl

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

Mallikarjun patil

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

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
Forward
0 new messages