Error while calling C# from java using jni4net from 64 bit Os

Morgan Denis

I am trying to call C# function from java using jni4net which work fine in windows 32 bit os however when I try to load same C# dll from a 64 bit OS am gettig this error

C:\Program Files (x86)\csharp\jni4net.n.w64.v20-0.8.6.0.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
 at java.lang.ClassLoader$NativeLibrary.load(Native Method)
 at java.lang.ClassLoader.loadLibrary0(Unknown Source)
 at java.lang.ClassLoader.loadLibrary(Unknown Source)
 at java.lang.Runtime.load0(Unknown Source)
 at java.lang.System.load(Unknown Source)
 at net.sf.jni4net.CLRLoader.init(CLRLoader.java:47)

and here is my code

public class JNIFromC
{
private static String BRDIGE_INIT_URL="C:\\Program Files (x86)\\csharp\\jni4net.n.w64.v20-0.8.6.0.dll";
private static String JNI_URL="C:\\Program Files (x86)\\csharp\\csharp.j4n.dll";
    public static void main(String[] args) {
        Csharp cSharp=new getMyFunctionsFromCSharp();

    }
 public static Csharp getMyFunctionsFromCSharp() throws IOException {

        Bridge.setClrVersion("v20");
        Bridge.init(new File(BRDIGE_INIT_URL));
        File shardFile = new File(JNI_URL);

        Bridge.LoadAndRegisterAssemblyFrom(shardFile);
        return new Csharp();
    }
}

What could I be doing wrong

Pavel Savara

You need to compile your C# program with 32 bit flag. Or you could use corflags {my.exe} /32BIT+ /Force. That would make your process to start as 32bit process.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Error in the webapp while connecting with JVM using jni4net from C#

From Dev

Error while calling java from PL/SQL

From Dev

Calling C functions from julia on windows 7 (64bit)

From Dev

Calling C++ 64bit shared library from Python

From Dev

Using 32 bit library from 64 bit project - .NET

From Dev

Error while calling External REST URL from netsuite using token

From Dev

Calling VirtualQueryEx function from a 64 bit process on a 32 bit one

From Dev

When upgrading from 32 bit OS to 64 bit OS in Windows XP, is it enough to format C: alone?

From Dev

Native ANSI C library from .NET Framework >= 4 on 64 Bit

From Dev

Internal Server error while calling an Java method from JSP

From Dev

Error while calling C DLL function from Python

From Java

UnsatisfiedLinkError exception while working with dll and java jni4net

From Dev

Error While Calling Code From other class in Asp.net

From Dev

issue passing mat from java to c++ jni android arm64-v8a 32/64 bit

From Dev

Event handling at calling a third party 32-bit dll from a 64-bit c# WinForms application

From Dev

Calling Excel from VFP9 on 64-bit machine

From Dev

Problems from using Office 64bit

From Dev

authorization error while calling adapter from iphone

From Dev

Error while calling Fragment class from activity

From Dev

Calling java function from c++ using jni: Failed to find static method id

From Dev

Calling a Java Method from the native code using jni

From Dev

smooth 64bit input from vertex to frag shader - "error C7570: 64 bit input should be flat"

From Dev

Calling RenderScript from C / JNI

From Dev

Error while calling function from procedure from same package

From Dev

JNI calling Java from C++ with multiple threads

From Dev

JNI: Calling a java method from C periodically is not working

From Dev

Java JNI NullPointerException after calling method from C with valid pointers

From Dev

Error while reading blob (binary) data from mongodb using Java

From Java

Error while using the load class from Java to import property file

Related Related

  1. 1

    Error in the webapp while connecting with JVM using jni4net from C#

  2. 2

    Error while calling java from PL/SQL

  3. 3

    Calling C functions from julia on windows 7 (64bit)

  4. 4

    Calling C++ 64bit shared library from Python

  5. 5

    Using 32 bit library from 64 bit project - .NET

  6. 6

    Error while calling External REST URL from netsuite using token

  7. 7

    Calling VirtualQueryEx function from a 64 bit process on a 32 bit one

  8. 8

    When upgrading from 32 bit OS to 64 bit OS in Windows XP, is it enough to format C: alone?

  9. 9

    Native ANSI C library from .NET Framework >= 4 on 64 Bit

  10. 10

    Internal Server error while calling an Java method from JSP

  11. 11

    Error while calling C DLL function from Python

  12. 12

    UnsatisfiedLinkError exception while working with dll and java jni4net

  13. 13

    Error While Calling Code From other class in Asp.net

  14. 14

    issue passing mat from java to c++ jni android arm64-v8a 32/64 bit

  15. 15

    Event handling at calling a third party 32-bit dll from a 64-bit c# WinForms application

  16. 16

    Calling Excel from VFP9 on 64-bit machine

  17. 17

    Problems from using Office 64bit

  18. 18

    authorization error while calling adapter from iphone

  19. 19

    Error while calling Fragment class from activity

  20. 20

    Calling java function from c++ using jni: Failed to find static method id

  21. 21

    Calling a Java Method from the native code using jni

  22. 22

    smooth 64bit input from vertex to frag shader - "error C7570: 64 bit input should be flat"

  23. 23

    Calling RenderScript from C / JNI

  24. 24

    Error while calling function from procedure from same package

  25. 25

    JNI calling Java from C++ with multiple threads

  26. 26

    JNI: Calling a java method from C periodically is not working

  27. 27

    Java JNI NullPointerException after calling method from C with valid pointers

  28. 28

    Error while reading blob (binary) data from mongodb using Java

  29. 29

    Error while using the load class from Java to import property file

HotTag

Archive