JNI vs JNA, calling Java from Fortran95

Chaitra Raghunath

I am trying to implement the following: Compute something in Java and return value to Fortran. I implemented it using JNI and the sequence is as follows:

Fortran 95 -> C -> Java (Computes something)

 Java (returns value to Fortran 95) -> C -> Fortran95

Can this be achieved using JNA? If so, what are the advantages?

technomage

Fortan's shared libraries are compatible with C, so JNA should be able to access any interfaces exported, including those that have callback inputs.

The advantages of JNA over JNI:

  • Speed of development You don't have to configure or compile any native code, which can significantly speed up your development/build cycle.
  • Clarity JNA's mappings look just like the functions you'd be calling in native code, but you get to use Java semantics instead of translating Java into C/JNI, and then C/JNI into appropriate wrappers around Fortran
  • Maturity of Code JNA has already worked out the gotchas and details of managing the native interface, so you can focus on solving your real problems instead of doing plumbing. However, if you like to do plumbing, JNI is always there.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

JNI vs. JNA performance

From Dev

Calling a static void Java method from JNI

From Dev

Register callback from Java to C via JNI or JNA

From Dev

Calling Java Methods from JNI results in program crash

From Dev

JNI calling Java from C++ with multiple threads

From Java

Calling into a saved java object via JNI from a different thread

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

Calling a Java Method from the native code using jni

From Dev

java call Hook by jna/ jni failed

From Dev

Call fortran dll from java using JNI

From Dev

Calling RenderScript from C / JNI

From Dev

Calling Fortran 95 dll from VBA with structure containing a dynamic array

From Dev

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

From Java

Calling a DLL from an Applet via JNI

From Dev

Calling dll implemented JNI from C++

From Dev

Calling C system calls from JNI

From Dev

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

From

Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

From Dev

How to resolve a Bad global or local ref passed to JNI error when calling a java method from native code

From Dev

JNI Calling Java Method With Array Parameter

From Java

JNI and Java: ant calling make or make calling ant?

From Java

JNI: From C code to Java and JNI

From Dev

Integration of Fortran code with Java by JNI

From Dev

Android Java Access from JNI

From Dev

UnsatisfiedLinkError in Java, coming from JNI

From Dev

Send MotionEvent from Java to JNI

From Dev

Create a Java enum from the JNI

From Java

How to manipulate memory from Java with JNA on Windows

Related Related

  1. 1

    JNI vs. JNA performance

  2. 2

    Calling a static void Java method from JNI

  3. 3

    Register callback from Java to C via JNI or JNA

  4. 4

    Calling Java Methods from JNI results in program crash

  5. 5

    JNI calling Java from C++ with multiple threads

  6. 6

    Calling into a saved java object via JNI from a different thread

  7. 7

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

  8. 8

    Java JNI NullPointerException after calling method from C with valid pointers

  9. 9

    Calling a Java Method from the native code using jni

  10. 10

    java call Hook by jna/ jni failed

  11. 11

    Call fortran dll from java using JNI

  12. 12

    Calling RenderScript from C / JNI

  13. 13

    Calling Fortran 95 dll from VBA with structure containing a dynamic array

  14. 14

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

  15. 15

    Calling a DLL from an Applet via JNI

  16. 16

    Calling dll implemented JNI from C++

  17. 17

    Calling C system calls from JNI

  18. 18

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

  19. 19

    Calling Golang from Java using JNI on Windows leads to "A dynamic link library (DLL) initialization routine failed"

  20. 20

    How to resolve a Bad global or local ref passed to JNI error when calling a java method from native code

  21. 21

    JNI Calling Java Method With Array Parameter

  22. 22

    JNI and Java: ant calling make or make calling ant?

  23. 23

    JNI: From C code to Java and JNI

  24. 24

    Integration of Fortran code with Java by JNI

  25. 25

    Android Java Access from JNI

  26. 26

    UnsatisfiedLinkError in Java, coming from JNI

  27. 27

    Send MotionEvent from Java to JNI

  28. 28

    Create a Java enum from the JNI

  29. 29

    How to manipulate memory from Java with JNA on Windows

HotTag

Archive