Basic HTML version of Foils prepared 2 October 98

Foil 12 Java - native language communication

From Netscape's LiveConnect Technology CPS640 Internet and Multimedia Technologies -- April 98. by Marek Podgorny,Nancy McCracken


1 Example
  • create java class - file ex1.java:
    • public class ex1 {
    • public native int funct();
    • static{ System.loadLibrary("ex1.so"); }}
  • create java byte code ex1.class: javac ex1.java
  • create ex1.h header file for native code: javah ex1
  • create ex1.c stub - interface between ex1 Java class and C language: javah -stubs ex1
  • implement native method libex1.c:
    • #include ex1.h; funct() { ... }
  • compile ex1.c and libex1.c and link it into dynamic library ex1.so

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sun Nov 29 1998