JNBridge support, knowledgebase, and documentation JNBridge: Java .NET interoperability

JNBridgePro Technical Tips

  1. You can generate proxies using plug-ins for Visual Studio or Eclipse, a standalone GUI-based proxy generation tool, or a command-line-based proxy generation tool. The command-line tool is fully scriptable, and can be used in build scripts.
  2. During the evaluation period, you can toggle between SE and EE capabilities to determine which is appropriate to your requirements. You can do this toggling through the JNBridge registration tool or through the Help->Register JNBridgePro... menu item in the proxy generation tool.
  3. The JNBridgePro installer installs two versions of JNBridgePro: a version targeted to .NET Framework 2.0 and later, and a version targeted to .NET Framework 1.1 and 1.0. Use the one corresponding to the .NET Framework on which you plan to deploy.
  4. You can embed Java AWT controls inside .NET Windows Forms applications, and .NET Windows Forms controls inside Java AWT and SWT applications.
  5. JNBridgePro allows you to access and instantiate .NET generic classes and methods from Java.
  6. There's an option to generate "J2SE 5.0-targeted proxies" in the Java Options dialog box. Turn this on when you want to map .NET enums to Java enums.
  7. You can use Secure Sockets Library (SSL) to communicate between the .NET and Java sides.
  8. You can use JNBridgePro to allow .NET objects to communicate with Java RMI servers, and you can even get callbacks from the RMI objects.
  9. Did you know that in shared-memory communications, the Java virtual machine is automatically started up in the same process as the .NET client? The communications between the Java and .NET sides is through shared data structures, so no socket overhead is incurred.
  10. Did you know you can configure JNBridgePro through your application’s configuration file? You can also configure JNBridgePro programmatically from your code.
  11. You can use directly-mapped collections to decrease the time required to access elements of a collection. Mapped collections will convert a whole Vector, ArrayList, or Hashtable between Java and .NET.
  12. You can directly convert between Java Date objects and .NET DateTime objects.Similarly, you can directly convert between .NET decimal objects and Java BigDecimal and BigInteger objects.
  13. You can pass objects by reference or by value. There are menu options in the JNBProxy GUI-baed proxy generator, as well as in the Visual Studio and Eclipse plug-ins, which let you select pass by value; pass by reference is the default.
  14. You can create .NET callback classes that are called from the Java side when certain events occur. Remember to annotate the .NET class proxy with the [Callback] or [AsyncCallback] attributes.
  15. You can use JNBridgePro for bi-directional interoperability. You can construct programs that contain both .NET-to-Java and Java-to-.NET calls, where the Java and .NET sides are both client and server.
  16. You can use the JNBProxy GUI-based proxy generation tool, as well as the Visual Studio and Eclipse plug-ins, to save a list of classes as a text file. That text file can then be read by the command line tool proxy-generation tool, and allows the proxy generation operation to be scriptable.
  17. If you’re integrating with a J2EE application server, it’s likely we have an example. From the Start Menu, select All Programs --> JNBridgePro --> Using JNBridgePro with... Examples include WebLogic, WebSphere, and JBoss.
  18. Did you know there’s a J#-compatible option? Use the check box labeled "Generate J#-compatible proxies" in the Java Options dialog box.
  19. You can assign .NET strong names to your proxy assemblies. To strong name a proxy assembly, select the Project --> Strong Naming Options menu item. When you strong name your proxy assemblies, you can place them in your Global Assembly Cache (GAC). You can also distribute the proxies to others, who can be confident that the assemblies come from you and that they haven’t been tampered with.
  20. You can obtain information about the Java side with which your .NET-side client program is communicating, through a JNBridgePro API. The method static bool com.jnbridge.jnbproxy.JavaSides.isAlive(string name); will return true if the Java side is currently running. In addition, the property static string com.jnbridge.jnbproxy.JavaSides.CurrentJavaSideName { get; } returns the name of the currently active Java side, and the method static com.jnbridge.jnbcore.JavaSideInfo com.jnbridge.jnbproxy.JavaSides.getJavaSideInfo(string name) returns a JavaSideInfo object containing information about the Java side.
  21. You can maintain fine-grained control over cross-platform garbage collection through use of the System.IDisposible interface and the Dispose() method(in .NET-to-Java projects), and the dotNetDispose() method (in Java-to-.NET projects).
  22. You can have .NET code call Java code running in Tomcat.
  23. You can have .NET code integrate with JMS messaging servers.
  24. You can run the Java-side on any machine from a PC to a mainframe.
  25. You can use JNBridgePro with ASP.NET Web applications, Web services, or Windows services.
  26. You can call servlets from ASP.NET.
  27. If you want the .NET side to automatically start and stop the Java side, the best way is by using the shared-memory communications channel.
  28. You can access COM components from Java by placing them in runtime callable wrappers (RCWs), generating a Java-side proxies for the RCWs, and calling the proxies.
  29. You can call Java from COM components by generating .NET side proxies for Java classes, creating a COM-callable wrappers (CCWs) from the proxy assembly and calling the CCW from the COM components.
  30. You can designate proxy classes as “thread-true”. Thread-true classes guarantee that Java API calls that begin and commit a transaction are made from the same thread, rather than the next available thread in the pool. Specifying thread-true classes also guarantees that calls from different .NET threads are handled by separate Java threads. This allows .NET code to make multiple calls to Java code that participates in a single Java transaction.

What's New?

QUICK LINKS




Microsoft Gold Certified Partner

Sun Partner Advantage