Exception in thread "main" java.lang.UnsatisfiedLinkError:

2,009 views
Skip to first unread message

Ramesh

unread,
Jul 8, 2011, 7:23:15 AM7/8/11
to jni4net
Hi i am getting the follwing error when i try to call .net dll from
java

Exception in thread "main" java.lang.UnsatisfiedLinkError:
orClass10(Lnet/sf/jni4net/inj/IClrProxy;)V

any help
Thaks in advance

Pavel Šavara

unread,
Jul 8, 2011, 7:33:39 AM7/8/11
to jni...@googlegroups.com
You probably forgot to call one of these
Bridge.init();
Bridge.LoadAndRegisterAssemblyFrom(new java.io.File("xxxx.j4n.dll"));

See http://code.google.com/p/jni4net/source/browse/trunk/content/samples/myCSharpDemoCalc/MyCalcUsageInJava.java

Pavel

> --
> You received this message because you are subscribed to jni...@googlegroups.com
> http://groups.google.com/group/jni4net?hl=en-GB?hl=en-GB
> http://jni4net.sf.net/
>

guttula ramesh

unread,
Jul 8, 2011, 8:24:37 AM7/8/11
to jni...@googlegroups.com
I have called it. My code is follows
 
 Bridge.init();
 Bridge.LoadAndRegisterAssemblyFrom(new File("E:\\pocNet\\poc\\ClbSample.j4n.dll"));
 Class1 a=new  Class1();
   a.Getdata();
 
the error is comming at "Class1 a=new  Class1();" which is proxy class.

Pavel Šavara

unread,
Jul 8, 2011, 8:28:27 AM7/8/11
to jni...@googlegroups.com
Is Class1.generated.cs part of ClbSample.j4n.dll ?

Venkata Ramesh Guttula

unread,
Jul 12, 2011, 5:42:22 AM7/12/11
to jni...@googlegroups.com
HI I am getting following error when I try to run proxygen on .net dll.

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the
requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
at System.Reflection.Assembly.GetTypes()

any help
Thanks in advance.
Ramesh.

--

Pavel Šavara

unread,
Jul 12, 2011, 6:36:56 AM7/12/11
to jni...@googlegroups.com
Share more details about what you do and what you tried to mitigate
your problems.

Mohan Nade

unread,
Jan 29, 2015, 7:29:49 AM1/29/15
to jni...@googlegroups.com
I am facing issue but in a bit weird way.

Created a proxy for a c# dll.
That generated the work folder which contained

MyOriginalCS.dll <this was my original dll>
MyOriginalCS.j4n.dll
jni4net.n-0.8.8.0.dll
jni4net.n.w32.v20-0.8.8.0.dll
jni4net.n.w32.v40-0.8.8.0.dll
jni4net.n.w64.v20-0.8.8.0.dll
jni4net.n.w64.v40-0.8.8.0.dll
OEM_PROVIDED_CS_BASED.dll <this is OEM's DLL that I wanted to use>

The work folder also contained other xml files etc.

The java code is able to call it in this folder.

But when I copy these dlls and jars files to different location, it starts giving following error.

java.lang.UnsatisfiedLinkError: MyOriginalCS.MYOEM_Wrapper.__ctorFOH02_Wrapper0(Lnet/sf/jni4net/inj/IClrProxy;)V




Mohan Nade

unread,
Jan 29, 2015, 11:33:55 AM1/29/15
to jni...@googlegroups.com

The steps I had followed was to create CS DLL, run proxygen to generate bunch of files under work folder
Created java project in eclipse and use those stuff and it works here

I just move those created files from work folder to another location, change the file supplied to
LoadAndRegisterAssemblyFrom to be from new location, and it fails with

UnsatisfiedLinkError: MyOriginalCS.MYOEM_Wrapper.__ctorFOH02_Wrapper0(Lnet/sf/jni4net/inj/IClrProxy;)

So is it something to do with the directory structure that one has to follow the same dir structure as when the proxygen was executed?
Or am I missing something stupid here?


Mohan Nade

unread,
Jan 30, 2015, 5:27:37 AM1/30/15
to jni...@googlegroups.com
Please ignore the replies above.
Figured out my mistakes.

The eclipse was referring to some old stuff, which were cleaned out when I cleaned the project in eclipse it worked well for me.

Thanks you !


Arpitha H M

unread,
Apr 14, 2015, 7:40:04 AM4/14/15
to jni...@googlegroups.com
Hi, 

I am getting the error "UnsatisifiedLinkError" when i try to use the C# dll in my Java class.

Followed all the steps and imported all the required libraries. 

Below is my class :

package dll.test;

import java.io.File;
import java.io.IOException;

import net.sf.jni4net.Bridge;
import test.Maths;

public class Program{

public static void main(String args[]){
        try {

            Bridge.setVerbose(true);
            Bridge.init();

            Bridge.LoadAndRegisterAssemblyFrom(new File("Test.j4n.dll"));

        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

        Maths test = new Maths();
        
        test.Add(2,3);
//        test.Repeat("It works!");
        
}
}

Please let me know how to resolve this error..

Thanks in advance!

Arpitha

deepthi koka

unread,
May 20, 2015, 5:13:38 AM5/20/15
to jni...@googlegroups.com

Hello Pavel,

I was trying to call a simple method written in CSharp from my Java code using the proxygen generated classes. I see that my dlls are getting loaded perfectly, but after that when I tried calling the method I am getting the following exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: sharpauthenticator.Authenticator.Authenticate(Ljava/lang/String;Ljava/lang/String;)Z
at sharpauthenticator.Authenticator.Authenticate(Native Method)
at com.gea.jniexample.JNI4NetAuthenticator.main(JNI4NetAuthenticator.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)


Following is my java code:
public class JNI4NetAuthenticator {
    public static void main(String args[])
    {
        Bridge.setVerbose(true);
        try {
            Bridge.init();
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        File proxyAssemblyFile = new File("SharpAuthenticator.j4n.dll");
        Bridge.LoadAndRegisterAssemblyFrom(proxyAssemblyFile);
        //sharpauthenticator.Authenticator authenticator = new   sharpauthenticator.Authenticator();
        boolean resultFromCSharp =sharpauthenticator.Authenticator.Authenticate("user","pass");
        System.out.println("resultFromCSharp"+resultFromCSharp);
    }

}  

Can you please help me on this?

Thanks,
Deepthi. 

RAJESH KUMAR

unread,
Sep 12, 2015, 1:01:39 AM9/12/15
to jni4net
Hi i am getting the follwing error when i try to call .net dll from
java

I am New to vb.net and i want to use existing vb.net code in to my java application for that i choose your jni4net and i am using windows 32 bit operating system.

step 1 : created a library project in vb.net
step 2 : created a dll for that project
step 3 : downloaded the jni4net-0.8.8.0-bin.zip
step 4 : follow the steps https://github.com/jni4net/jni4net/wiki/
step 5 : created a java project in eclipse and try to execute but i am facing following exception.

loading core from D:/Rajesh/JNI4NET/jni4net.n-0.8.8.0.dll
loading jni4net.n-0.8.8.0, Version=0.8.8.0, Culture=neutral, PublicKeyToken=134a23405600bab4 from D:\Rajesh\JNI4NET\jni4net.n-0.8.8.0.dll
loaded jni4net.n-0.8.8.0, Version=0.8.8.0, Culture=neutral, PublicKeyToken=134a23405600bab4 from D:\Rajesh\JNI4NET\jni4net.n-0.8.8.0.dll
Initialized jni4net core
core loaded from D:/Rajesh/JNI4NET/jni4net.n-0.8.8.0.dll
clr.version :v4.0.30319
clr.arch :32bit
java.home :C:\Program Files\Java\jre1.8.0_60
java.version :1.8.0_60
sun.arch.data.model :32
loading SimpleDll.j4n, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null from C:\BhushanProg\SabreWork\Jni4Net\SimpleDll.j4n.dll
loaded SimpleDll.j4n, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null from C:\BhushanProg\SabreWork\Jni4Net\SimpleDll.j4n.dll
Exception in thread "main" java.lang.UnsatisfiedLinkError: simpledll.Sample.__ctorSample0(Lnet/sf/jni4net/inj/IClrProxy;)V
at simpledll.Sample.__ctorSample0(Native Method)
at simpledll.Sample.(Sample.java:25)
at Jni4NetTest.main(Jni4NetTest.java:22)

 

RAJESH KUMAR

unread,
Sep 15, 2015, 6:22:36 AM9/15/15
to jni4net

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

Reply all
Reply to author
Forward
0 new messages