Java/.NET integration made easy
JuggerNET is a development tool that solves complex Java/.NET integration problems. At a high level, it consists of the following components:
- a code generator, GUI and command line.
The code generator takes Java bytecode as input and generates platform- and compiler-portable C# source files, batch build files, and project files. The code generator represents our expert knowledge of the design-time aspects of Java/.NET interoperability. Unless you're an OEM customer, you usually only use the code generator in-house.
- a runtime library.
The runtime library comes in two flavors, strongly named and not strongly named, and provides an abstraction layer around the generic aspects of Java and .NET integration. The runtime library represents our expert knowledge of the runtime aspects of Java/.NET interoperability. The JuggerNET runtime leverages the JunC++ion runtime for the JVM integration angle. You ship the runtime library as part of your finished integration solution.
- a Shared JVM server.
The Shared JVM server provides you with an alternate deployment option that does not require the presence of a Java Runtime Environment on the host that is running your .NET code.
- lots of examples.
Some of the examples can be immediately useful to you because you just have to build them or customize them slightly to solve your particular integration problem.
You start out with some Java API that you wish to publish to .NET so that C#, VB.NET, or other .NET language developers can use it. The Java API in question could be your own product's API, or it could be a third-party API that you "inherited" from a different group.
You start the code generator GUI, drag and drop the jar file containing the Java API onto it, set the target directory for the generated files, and press the "Generate" button, done!
Well, in real life it's not usually quite that simple because
- you have to familiarize yourself with the code generator and its usually understandable peculiarities, and
- your jar file might depend on other jar files that you don't have or didn't think about at first, and
- the imported jar file might be too big and requires you to adjust the heap memory for the code generator, and
- the imported jar file contains 7000 types and you only want 20 of them, and ...
you get the picture.
All of these obstacles are easily overcome by using standard code generator features. After the first or second day of playing with the tool and your Java classes, you will typically have a pretty good understanding of how things work and you're 90% done with creating the set of C# types that will solve your integration problem.
What's next, now that you have some generated C# source files? You can use the generated batch files, or project files to compile the C# sources into an integration assembly and then start using the library from your own projects.
The entire process involving the code generator is usually completed within the first week of usage, with the majority of the time spent on fine-tuning the class set and the conversion options to facilitate easy integration into an overnightly build.
JunggerNET is a mature integration solution. It is being used in many business- and mission-critical applications. We don't like getting into feature comparison contests with the competition and we don't believe in Enterprise, Pro, Standard, Lite, Extra Lite, and Almost Not There feature matrices, so we will just present a table of features/decision making factors that will hopefully help you decide that the one and only version of JunC++ion is worth your consideration.
|"Smart" Code generator||The code generator understands the relationships between Java types. When you import a Java type, it automatically enables other Java types that are required on the .NET side to make that type useful (for example method argument types of enabled methods). When you instruct the code generator to disable a particular type, it automatically disables all dependent elements (methods, fields) that rely on the presence of that type.|
|Good Heuristics||If you make no modifications to the default generation settings, you will probably end up with something that is right for you or at least almost right for you.|
|High customizability||You can disable (almost) any type, any method, any field from becoming available in .NET.|
|Automation features||The code generator can persist the state of a project and then allow you to reopen it in the GUI or use it as part of an automated, command line-based build.|
|ANT integration||ANT is a very powerful, portableJava-based build system and the custom tasks for code generation and compilation allow you to create portable, automated, end-to-end integration builds.|
|Build support generator||The code generator generates build batch files and Visual Studio project files.|
|API Documentation generator||The code generator can optionally generate API documentation. It can generate a complete API reference manual even without access to the Java sources, but the results are even better if you can make the Java sourcefiles available to the code generator.|
|As lightweight as possible||The generated code delegates as quickly as possible to the runtime library to keep the proxy classes as small as possible.|
|Exception-safe||The generated code can be used in the presence of .NET exceptions without leaking objects on the Java side.|
|Multithread-ready||The generated code can safely and easily be used in multithreaded runtime environments.|
|Callback support||A Java interface can be flagged as a callback interface, causing the generation of callback support. This means that you can implement the Java interface in .NET and have the Java side call your .NET implementation asynchronously (EventListeners, etc.)|
|Highly usable types||The generated code is just about as usable as the underlying Java types and we just keep adding features to make it feel more native.|
|Fewest possible surprises||It is impossible to generate code that is totally without surprises. For example, .NET has a different array model than Java and that will have to be reflected somehow.|
|Works with virtually any Java2 JRE||In JNI mode, JuggerNET-enabled .NET applications have been tested with a multitude of JVMs, starting with Sun JRE 1.2.2.|
|Extremely high performance in in-process (JNI) mode||Even though JNI has a bad reputation, it is really quite fast. There is inevitable overhead, but you will be very positively surprised by the performance of your integrated application.|
|Out-of-process (Shared JVM) deployment option||This is a much slower mode of operation, but you can avoid having to deploy Java with your .NET application; just one more deployment option for you.|
|Mature configuration framework||You need to tell your .NET application where to find the Java parts of the application and how to initialize the JVM or connect to the shared JVM server.
You have extreme flexibility, from hardcoding the settings, over using XML config files, all the way to self-configuring DLLs via configuration callbacks.
|No server necessary||Your finished integrated solution can be totally self-contained without any additional "moving pieces" required.|
|"xcopy" deployable||Just copy or move the integrated solution and double-click the executable. If you configured things correctly, it will still work, no registration steps necessary.|