The FreeHEP Geant4 Java Wrapper

IMPORTANT

This is work in progress and does not even deserve the alpha status. Do not use this for production.

Introduction

Wraps the Geant4 C++ Toolkit to make it accessible from java.

The Geant4 kernel and most of the extensions such as visualization and interfaces were wrapped using the Java Native Interface (JNI) to allow users to program Geant4 application code in Java. User code can create Geant4 objects from Java, call methods on those, but also inherit from Geant4 C++ classes and override methods in Java. The G4Java infrastructure allows the user to interact with Geant4 in the Java language by adding a jar file to the classpath and refering to a single Geant4 shareable object.

The Geant4 novice examples were all rewritten in Java to show how one can use Geant4 from Java using G4Java. Also the extended analysis example A01 was rewritten in Java.

The Simple Wrapper Interface Generator (SWIG) was used to create the JNI code. By running all the Geant4 header files through SWIG and giving SWIG the correct instructions the generated Java and C++ wrapper code makes Geant4 classes look like Java classes. There are a few exceptions to be noted.

Feedback

If you have questions/comments/feedback please send them to: Mark.Donszelmann@slac.stanford.edu.