[ JCCF ] [ java APIs ] [ Using Java classes ]

Using Java classes

So far, we have seen examples of Java code using native code. The main program was always started by the Java runtime. This runtime includes the multi-threading support, the garbage collector etc.

That can we do if we need to use a Java program or a set of Java classes from another langage ?

The folowing example consist of a C++ program that manipulates a Java register. The important point is that the main program is wrote in C++. This program creates a JVM (see JVM.h and JVM.cc) and delegates, through an adapter, the work associated with the Register object to that JVM. Note that there is no reference to Java in the main program.

Links to source code :
  • Makefile
  • Register.h
  • main.cc
  • Register.java
  • Register.cc


  • © Alain.Miniussi@labri.u-bordeaux.fr
    Last updated = june 12th 1997
    url = native/registerV5/index.html