I am happy to announce an OMNeT++ extension that makes it possible to write OMNeT++ simple modules in Java. With JSimpleModule, simulation programmers can work with almost the same API as in C++ (thanks to wrapper objects generated using SWIG). Java and C++-based simple modules can be freely mixed in simulations. You can dowload it a source and a Windows binary package, the latter being an Eclipse project as well: [Source] [Windows binary+Eclipse project].
Operation is based on the JSimpleModule class. This is an ordinary C++ simple module, which receives the name of a Java class in a module parameter. During initialize, it loads the Java Virtual Machine (if not already loaded), instantiates the given Java class, then simply delegates initialize(), handleMessage() and finish() calls to it. The Java class should be subclassed from org.omnetpp.simkernel.JSimpleModule, which provides the usual methods: send(), scheduleAt(), cancelEvent(), etc. Messages are instances of org.omnetpp.simkernel.cMessage, and the org.omnetpp.simkernel package contains Java versions of most simulation kernel classes. The org.omnetpp.simkernel.* Java classes are just JNI-based wrappers around the corresponding C++ classes: every Java object holds a pointer to a corresponding C++ object, and delegates all method calls to it. This has a few consequences about the programming model. The wrapper classes have been generated using SWIG.
So, should I program all my simulations in Java now? No, probably not all your simulations, but it can be useful for smaller models with relaxed performance requirements, or if you want to reuse an existing body of Java code as part of an OMNeT++ simulation.
You can read more on the JSimpleModule wiki page.