3

I want to write a java program that uses the Windows API and that compiles to native code instead of byte code.

I don't want using JNI (C, C++, ... interface) but instead want to write using pure java code and JNA.

Would the GNU Java compiler allow me to do this? Does the GNU Java compiler support use of JNA?

Mat
  • 202,337
  • 40
  • 393
  • 406
Amir Saniyan
  • 13,014
  • 20
  • 92
  • 137
  • [CNI](http://gcc.gnu.org/onlinedocs/gcj/About-CNI.html) is alternative to JNI. If you can compile JNA classes with [JCG](http://en.wikipedia.org/wiki/GCJ), then you can benefit from it. But why do you want to make a dynamic call to native code from a native code? I think this is extra performance pitfall. – dma_k Aug 24 '11 at 07:44

1 Answers1

1

I believe that with the GNU Java compiler, one uses a different interface to link to native code, the CNI (Compiled Native Interface). CNI is related to JNI (Java Native Interface) framework (again, I believe).

Caveat: I have never used the GNU Java compiler nor CNI, but have used JNA and JNI.

Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
  • 1
    Someone tried to edit my answer, but on reading the attempted edit, I think we're all far better off if they write their own separate and informative answer. The information they have is very useful and should be shared and should stand on its own. :) – Hovercraft Full Of Eels Aug 21 '11 at 12:46
  • 1
    Pity, as my addon was useful, I think. It better to have one complete answer, rather then ten answers speaking about the same subject. – dma_k Aug 24 '11 at 07:37