1. Getting started
- 1.1. Installing Javonet
- 1.2. Activating Javonet
- 1.3. Adding References to .NET Libraries
- 1.4. XML Configuration File
- 1.5. Using the Javonet Fluent Interface
- 1.7. Introduction to Using .NET Back-end and UI Components in Java
2. Calling methods
- 2.1. Invoking Static Methods
- 2.2. Creating Instance and Calling Instance Methods
- 2.3. Calling Generic Methods
3. Working with .NET Objects
- 3.1. Creating Instance Of Generic Object
- 3.2. Extending the .NET Class in Java and Wrapping .NET Methods
4. Fields and Properties
- 4.1. Get/Set Values for Static Fields and Properties
- 4.2. Get/Set Values for Instance Fields and Properties
5. Methods Arguments
- 5.1. Passing Reference-Type Arguments
- 5.2. Passing Arguments by Reference with “ref” and “out” Keywords
- 5.3. Passing typeof(Type) as Method Argument
- 5.4. Calling Overloaded Method Passing Null Argument
6. Nested Types
7. Enums
8. Arrays and Collections
- 8.1. Arrays: Using Value-Type and Reference-Type Arrays
- 8.2. Working with .NET arrays and collections from Java with Javonet
9. Embeding UI controls
10. Referencing libraries
11. Off-line activation
12. Events and Delegates
13. Disposing and Garabage Collection
14. .NET Configuration Files (AppConfig, WebConfig)
15. Exceptions, Debugging and Testing
- 15.. Handling Activation Issues
- 15.1. Handling .NET Exceptions
- 15.2. How to debug .NET code called from Java
- 15.3. Debugging Javonet Enabled Application
16. Strongly-Typed Wrappers
17. Advanced Activation and Licensing
- 17.1. Runtime vs. Offline vs. Compile Time Activation
- 17.2. Project Activation Tool
- 17.6. Delegating Activation Server
18 Other usage scenarios
Using back-end and/or UI .NET components in Java can be as easy as working with regular pure Java components. With Javonet you can take any existing .NET component in form of DLL libraries and just use them directly within any Java console, service, web, EJB or desktop project. Javonet framework is based on native integration so the performance of using any component is almost the same as working with single technology.
There are no limits on the operations that you can invoke on the .NET control therefore without any sacrifice you can use any critical and best components from .NET world in Java application. This can be CAD modelling control, bar code detection algorithm, OCR algorithm, speech recognition component, specific data formats parser and many more.
This guide is an introduction for developers interested in using any existing third-party .NET back-end and UI components from Java:
- Introduction to Javonet – Learn why it is safe, efficient and beneficial
- How Javonet Works – A brief introduction how Javonet works to allow using .NET UI and back-end components in Java
- Get Started! – Dive in and build your first cross-technological Java application
- Partners and Samples – see some great .NET components officially supporting Java through Javonet and sample projects
Introduction to Javonet
Javonet is a framework that allows to utilize the native integration technology in the most simple and efficient way to get most out of its benefits. The native integration is the concept of loading two different managed runtimes within single operating system process (i.e. CLR and JVM) and creating native binding between them to allow cross-platform communication.
The idea of re-using any .NET modules in Java and any Java module in .NET is not only great way to save a lot of time, get access to more tools and resources, increase the application scope of particular pieces but also a great way to save costs on third-party components and remove the barriers of technology you choose for your project regardless of modules you need to utilize.
As each module is loaded and executed by its own runtime the performance and reliability is guaranteed by design. The direct binding between the calls on Java methods to the .NET code provides native performance which in combination with encapsulation within single OS process make it transparent for end-user providing the same experience like single-technology application does.
How Javonet Works
Javonet consists of multiple modules:
- Javonet API – set of classes for Java developers which simplify and allow any operations on any .NET object from Java code. The standard API is generic and flexible to be used with any object. You can use the .NET APIs as they are by creating instances of .NET objects in Java, calling .NET methods, setting or getting properties and even subscribing to .NET events.For UI components Javonet API exposes the dedicated NControlContainer class which allows to easily put any .NET user control within Java AWT, Swing or JavaFX interface and interact with it like with any other Java component. The control will automatically adjust to the Java layout and will live within the Java window.
Javonet API is prepared to allow easy creation of strongly-typed interfaces for particular .NET classes or entire .NET libraries. This kind of interfaces replicate the methods signatures from .NET and provide completely pure Java experience for all other developers using these objects. From development and end-user perspective it is unnoticeable that anything is process by other runtime.
- Core Engine – internal infrastructure which takes care of initializing .NET CLR runtime within Java process and creating native bounds between Java operations on .NET objects to .NET methods, properties, events or classes. Core modules take care also of on-the-fly data-types conversions, objects lifecycle management or threads synchronization.
- CLR Module – this module is responsible of coordinating the .NET execution of operations performed on Java side and keeping the .NET environment in sync with your Java application.
Using Javonet API you can do everything what you normally would do with the classes provided in third-party component. You can use static types, created instances of objects, work with these objects, pass and retrieve data or embed them in the Java UI if these are UI elements. It means that now you can treat anything created in .NET as modules available for your Java project.
Getting Started
Now you have learned a little about Javonet and benefits of accessing .NET code from Java. Let’s dive in!
Follow these steps to start using preffered component in Java:
- Choose and download preferred .NET back-end or UI component that could be useful in your Java project
- Signup for free Javonet trial key: Register for free trial
- Activate Javonet
- Copy .NET DLLs to Java project and reference them from your code
- Start working with the component like it was made for Java:
Partners and Samples
Everyday you can find more .NET back-end and UI component vendors who officially open their products for Java markets through Javonet. For some vendors you need to use Javonet on your own to access their products whereas others might already provide ready to use Java JAR packages which encapsulate their .NET code-base, Javonet and strongly-typed interfaces inside.
Dragon Medical speech solutions for Clinicians
Dragon Medical solutions accurately translate the doctor’s voice into a rich, detailed clinical narrative that feeds directly into the EHR. Now the Dragon Speech Recognition controls are available for Java desktop applications. The solution is provided natively by the Nuance Company, for more details check:
https://www.nuance.com
Eyeshot Ultimate 10
Eyeshot is a CAD control based on the Microsoft .NET Framework. It allows developers to add CAD functionalities to WinForms and WPF applications in a snap. Eyeshot provides tools for building geometry from scratch, for analyzing it with finite element method and to generate toolpaths on it. Geometry can also be imported or exported using CAD exchange file formats. Now devDept Eyeshot package is available for Java AWT, Swing and JavaFX applications.
http://devdept.com/ – read more on vendor website
Check live sample and source code!
New-Doors Medical UI Components
New-Doors is providing customized solutions for medical applications, dedicated dictation UI component is now available for Java Swing applications. For more details contact New-Doors at:
http://www.new-doors.net/