Javonet 1.5 Released – Open for .NET developers and even more for Java!

Tags

After months of intensive work and close cooperation with many of our customers we have finalized the latest Javonet release. This release provides a lot of improvements for Java developers and includes completely new product for opposite direction dedicated for .NET developers. Read more to learn details about each change applied in latest Javonet. 

Open for .NET developers 

With that release the biggest change that comes is the support for .NET developers who want to use Java packages in .NET desktop, web or service application. 

It is now possible to load any JAR file from .NET application and utilize the classes, objects, types, methods and logic stored in those packages. 

The Javonet for .NET developers supports a lot of the features that we provide for Java developers which include: 

  • Adding references to Java Jar packages. 
  • Loading Java types. 
  • Creating instances of Java objects. 
  • Calling instance and static methods. 
  • Setting and getting instance and static fields. 
  • Built-in data types conversion for arguments and results. 
  • Returning references to complex objects. 
  • And much more… 

We continue works on this release so feel free to share with us what is most important for you and we will cover that with higher priority. 

You can download Javonet for .NET developers by signing up for 30 days free trial: 

https://my.javonet.com/signup/?type=free 

Further Improvements for Java Developers 

The Javonet for Java developers is utilized around the world by more than 1500 companies and develops at amazing pace with all the feedback and scale effect compound experience from all our users.  

Some of the key changes: 

  • Support for by ref arguments used in events delegates – now .NET side can pass by ref arguments to events listened and processed on Java side. 
  • Removal of embedded apache commons lang and configuration packages to avoid version conflict in target projects. 
  • Override hashCode for NNull objects. Now the two instance of .NET Null objects will be properly compared in logical statements and collections 
  • Initializing .NET delegates with NType. 
  • Support to retrieve SByte array from .NET side. 
  • Simplified arrays initialization. Now you can call Javonet.New(“String[]”) and Javonet will initialize the string array. 
  • Support for events calls where argument is array of primitive types. 
  • Improved access to fields on MarshalByRef objects including the resolution of fields defined through inherited interfaces 
  • Improvements in NObject disposal to address the issues with delayed or blocked disposal in case of multiple .NET events handlers registered. 
  • Added the ability to specify the fixed paths for .NET libraries so they are properly resolved with dynamic code (XAML elements, app.config custom sections, code compiled at runtimed, etc..). Custom paths can be set from code or through javonet.xml configuration file. 
  • Ability to set license file directory through javonet.xml file. 
  • Extended Javonet welcome message with more details about current configuration. 
  • Support to call methods declared with explicit interface declaration in example IInterface.MethodName(args …); 
  • New NException – now all the .NET exceptions from your libraries will be raised as NException which provides all the details from .NET exception, merges stacktraces, supports internal exceptions and gives access to operator on the .NET exception type. More about NException will be described in next articles. For backward compatibility we still support old exceptions mode that can be enabled from code using Javonet.setUseLegacyExceptions(bool value) or through javonet.xml configuration file. 
  • Fixed the issue of subscribing two events on the same object where one delegate is expecting result and the other one is not. 

UI and Backend Components Revolution 

As our unified backend and UI components revolution speeds up we put a lot of efforts into the Javonet modules responsible for embedding and exposing existing .NET WPF and WinForms user controls and back-end components like Image recognition, barcodes, 3d modelling and much more to Java developers. 

The key focus is to make sharing any .NET components with Java developers a seamless experience without any compromises. The components must work, look and perform the same way as they do in .NET. Also, we focus on assuring that the exposure through strongly typed interfaces is painless and efficient. 

The changes implemented in this field: 

  • Full integration of UI components in Java UI so that switching between Java and .NET component does not affect the way main window looks like. 
  • Improvement to focus restoration so .NET components regain properly focus on windows switching and deiconification. 
  • Improved memory management to make sure that .NET user controls are properly disposed when the Java window is closed. However we also supported the ability to re-use the previously initiated UI components in new windows after detaching from previous UI. 
  • Introduction of new NControlJContainer – the new container is dedicated for Swing applications and resolves the known Java bug in heavyweight and lightweight controls mixing. As .NET components are always heavyweight it is critical to make sure they will draw and move properly in Swing interfaces and now using new container it is guaranteed. 
  • Supported adding controls to existing and visible windows. 
  • Added support for using mnemonic keys with WPF components. Now user can change from Java controls to .NET control and from .NET to Java with mnemonic keys like ALT+X, ALT+K etc.. 
  • Added support for native access to WPF window from WPF user controls embedded in Java. Now controls can use Window.GetWindow(this); like is normally expected and will receive proper handle that can be passed to MessageBoxes and Dialog windows as parent. 
  • Added support for parent window blocking to make sure the Java windows are properly blocked if .NET component is showing modal or modeless popups. 
  • Added ability to configure if .NET message pump should live across entire lifecycle of Java application or only if there is at least one .NET component visible. 
  • Added support for Tab cycle. Now you can cycle using Tab between Java controls and through elements of .NET WPF child control seamlessly. Tab navigation will iterate through properly across Java and .NET respecting Tab indexes. 
  • Added support to co-host .NET and native controls in Java windows especially including OpenGL elements. 

To provide seamless and pure Java experience and get most of the Java market for existing components it is crucial te create strongly typed wrappers. It means to reproduce the existing .NET interfaces using plain Java objects with the same method signatures. With that in place Java developers use .NET components as if they were native Java components. Therefore, it was important for us to apply also more improvements in this area. 

Improvements for implementing strongly typed wrappers: 

  • Ability to easily convert Java enum (replicating it’s .NET counterpart) into the NEnum object. Now Java enums can be used as argument in NEnum constructor or through new NEnum.fromJavaEnum(…), static method. 
  • Private handle fields – to avoid the need of exposing any Javonet API objects to Java developers using .NET cross platform components, we have designed a new way of connecting Java strongly typed wrappers with underlying .NET objects. Now if you enable the private handles mode, when any Java objects is passed to .NET side Javonet will look for private field named “handle” of “NObject” type and will use the underlying .NET object to process the call. More on private handles will be published in further articles. 

Even more reliable activation 

Some of the key requirements of our customers is to make sure that Javonet will not block the deployment or execution of their applications. Therefore, we have shifted our entire activation infrastructure into the new load balanced environment on Microsoft Azure with design focused on High Availability and distributed geo localization. 

We also made it possible to specify activation relay servers that can be used within environments with highly restrictive security rules. In such case the intermediate server with custom domain name can be specified which will be used by Javonet to route the activation calls that will be further forwarded to Javonet activation servers. 

Also, further improvements were applied in terms of activation only at compile time that is currently possible as an option for Javonet Professional and Javonet Enterprise licenses.