are you sure your c# dll is working? are your dll methods public?
you can create a c# test app which calls the dll methods just to see
if your c# dll is ok.
it seems you are loading correctly the generated dll.
2012/7/17 Balaji
Hi,I'm having the same problem, reading post for hours, and cannot resolve the error. What I did:- I created a simple C# project (Visual C# Windows Dll) in Visual Studio 2012:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace XWrapper
{public class Moveit{public static void moveTo(int station){System.Console.Write("Hello world.");}
}}I build the project and got a XWrapper.dll. Next, I called proxygen.exe with that DLL. It creates both a clr and jvm directory with this java class:package xwrapper;@net.sf.jni4net.attributes.ClrTypepublic class Moveit extends system.Object {//<generated-proxy>private static system.Type staticType;protected Moveit(net.sf.jni4net.inj.INJEnv __env, long __handle) {super(__env, __handle);}@net.sf.jni4net.attributes.ClrConstructor("()V")public Moveit() {super(((net.sf.jni4net.inj.INJEnv)(null)), 0);xwrapper.Moveit.__ctorMoveit0(this);}@net.sf.jni4net.attributes.ClrMethod("()V")private native static void __ctorMoveit0(net.sf.jni4net.inj.IClrProxy thiz);@net.sf.jni4net.attributes.ClrMethod("(I)V")public native static void moveTo(int station);public static system.Type typeof() {return xwrapper.Moveit.staticType;}private static void InitJNI(net.sf.jni4net.inj.INJEnv env, system.Type staticType) {xwrapper.Moveit.staticType = staticType;}//</generated-proxy>}There is a build.cmd also, so I used it and got a XWrapper.j4n.dll and a XWrapper.j4n.jar file. A Simple main to call the moveit(int) method is:public static void main(String[] args) throws IOException {
Bridge.init();Bridge.setDebug(true);Bridge.setVerbose(true);Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("D:\\Daten\\VisualStudio\\jni4net\\work3\\XWrapper.j4n.dll"));
Moveit.moveTo(1);}When running, the jni-DLLs are loading and I get the error:java.lang.UnsatisfiedLinkError: xwrapper.Moveit.moveTo(I)Vat xwrapper.Moveit.moveTo(Native Method)at ....main(StartXWrapper.java:40)What can I do? Any idea? Thank you!
It is not the first time that I ask this question but I'm really stuck here a quiet long time because of this problem here. I am not familiar with JNI and it wouldn't be necessary if there wasn't this - to me - strange issue:
I made an Eclipse Plug-in that uses .dll
-files which work on the .NET Framework. To do so I created a Java .NET Bridge using the jni4net framework which works so far but..
As I load my library from location A
(the place where the plugin is developed)
File wrapperDll = new File("C:\\A\\SibKernel.Server.JavaWrapper.j4n.dll");
I can run the Eclipse Applicatoin ant everything works as it should. But if I load it from location B
- which is just where my "standalone" Eclipse version is located
File wrapperDll = new File("C:\\B\\SibKernel.Server.JavaWrapper.j4n.dll");
this error occurs:
java.lang.UnsatisfiedLinkError: sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Lnet/sf/jni4net/inj/IClrProxy;)V
at sibkernel.server.sp40javawrapper.SP40Device.__ctorSP40Device0(Native Method)
at sibkernel.server.sp40javawrapper.SP40Device.<init>(SP40Device.java:25)
at sibeclipseplugin.debug.model.SP40Program.<init>(SP40Program.java:46)
at sibeclipseplugin.debug.model.SibDebugTarget.<init>(SibDebugTarget.java:67)
at sibeclipseplugin.ui.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:26)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Hi to all,
I am unable to execute using eclipse but execute the code from command prompt from windows.
Steps :
1.Created proxy files(using vb.net dll (SimpleDll.dll))
2. write java program.(Jni4NetTest.java)
3. copy proxy files and jar files in one folder
4.compile the java program
Ex:-
D:\Rajesh\jni4net>javac -d .\ -cp .\jni4net-0.8.8.0.jar;.\SimpleDll.j4n.jar Jni4NetTest.java
5.Run the java program
Ex:-
D:\Rajesh\jni4net>java -cp jni4net-0.8.8.0.jar;SimpleDll.j4n.jar;. Jni4NetTest
Please help me and thanks in advance
P Rajesh Kumar.
Hi all,
Now able to execute my eclipse application followed by this video link.
https://www.youtube.com/watch?v=tI0tFUjeffA (Using Jni4Net) from 25:14 mins onwards.
Thanks&Regrads,
P Rajesh Kumar