JCOBridge 2.2.1

The package contains all libraries and resources to bridge together .NET CLR (Core/Framework) and JVM (Java). All information, APIs and examples are available on https://www.jcobridge.com/.

Install-Package JCOBridge -Version 2.2.1
dotnet add package JCOBridge --version 2.2.1
<PackageReference Include="JCOBridge" Version="2.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add JCOBridge --version 2.2.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

JCOBridge main features

Field proven
Built on top of the field proven DLR plugin available in the Sinapse platform (https://www.sinapsesystem.com), JCOBridge guarantees the best performance in JVM and CLR worlds integration.

CLR : Available for .NET Framework for Windows on www.jcobridge.com and .NET Core on x86/x64/Arm/Arm64, Linux x64/Arm/Arm64 (other platforms/architectures available on demand)

  • Retrieve JVM class
  • Instantiate JVM objects
  • Invoke static methods
  • Invoke instance methods
  • Get/Set static fields
  • Get/Set instance fields
  • Use dynamic access to write code in a seamless way as it is done in Java language
  • Use specific interface to direct manages methods and fields
  • User interface Controls, properties and events management
  • Integrates Java UI (AWT/Swing/SWT) into WPF/WinForms (from version 2.2)

JVM : Available for .NET Framework on www.jcobridge.com and .NET Core Windows x86/x64/Arm/Arm64, Linux x64/Arm/Arm64 (other platforms/architectures available on demand)

  • Retrieve CLR Type
  • Instantiate CLR object
  • Invoke static methods
  • Invoke instance methods
  • Get/Set static properties
  • Get/Set instance properties
  • Set Delegates
  • Subscribe/Unsubscribe events
  • Integrates WPF controls into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • Integrate WinForms controls into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • Integrate complex .NET Graphical user interfaces objects into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • User interface Controls, properties and events management (experimental on .NET Core, use the version on Windows in production)

JCOBridge Coding simple example

Imagine you have the following Java Class:

public class MyJavaClass 
{
    //Static member
    static public String myStaticJavaHelloWorld()
    {
        return "Hello Static World from Java!!";
    }
    //Instance member
    public String myJavaHelloWorld()
    {
        return "Hello World from Java!!";
    }
    //Instance member
    public double myJavaAdd(double a, double b)
    {
        return a+b;
    }
}

you can call the previous Java class from C# using JCOBridge access to static and instance methods.

How to call Java code

Define a class that use the Java code:

class MyJavaUsingClass : SetupJVMWrapper
{
    public void Execute()
    {
        string hello = DynJVM.MyJavaClass.myStaticJavaHelloWorld();
        Console.WriteLine(hello); //Print "Hello Static World from Java!!"
        var myJavaClass = DynJVM.MyJavaClass.@new();
        hello = myJavaClass.myJavaHelloWorld();
        Console.WriteLine(hello); //Print "Hello World from Java!!"
        double result = myJavaClass.myJavaAdd(2.0, 3.0);
        Console.WriteLine("{1:0.0}",result); //Print "5.0"
    }
}

Add JCOBridge initialization before call the Execute method.

using MASES.LicenseManager.Common;
using MASES.JCBridge.C2JBridge;
using System;

static void Main(string[] args)
{
    MyJavaUsingClass JavaTest = new MyJavaUsingClass();
    JavaTest.Execute();
}

Other JCOBridge Examples

More information and more complex examples on www.jcobridge.com.
Meanwhile try the NuGet templates package with ready to use projects. NuGet JCOBridge Templates

JCOBridge main features

Field proven
Built on top of the field proven DLR plugin available in the Sinapse platform (https://www.sinapsesystem.com), JCOBridge guarantees the best performance in JVM and CLR worlds integration.

CLR : Available for .NET Framework for Windows on www.jcobridge.com and .NET Core on x86/x64/Arm/Arm64, Linux x64/Arm/Arm64 (other platforms/architectures available on demand)

  • Retrieve JVM class
  • Instantiate JVM objects
  • Invoke static methods
  • Invoke instance methods
  • Get/Set static fields
  • Get/Set instance fields
  • Use dynamic access to write code in a seamless way as it is done in Java language
  • Use specific interface to direct manages methods and fields
  • User interface Controls, properties and events management
  • Integrates Java UI (AWT/Swing/SWT) into WPF/WinForms (from version 2.2)

JVM : Available for .NET Framework on www.jcobridge.com and .NET Core Windows x86/x64/Arm/Arm64, Linux x64/Arm/Arm64 (other platforms/architectures available on demand)

  • Retrieve CLR Type
  • Instantiate CLR object
  • Invoke static methods
  • Invoke instance methods
  • Get/Set static properties
  • Get/Set instance properties
  • Set Delegates
  • Subscribe/Unsubscribe events
  • Integrates WPF controls into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • Integrate WinForms controls into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • Integrate complex .NET Graphical user interfaces objects into AWT/Swing window (experimental on .NET Core, use the version on Windows in production)
  • User interface Controls, properties and events management (experimental on .NET Core, use the version on Windows in production)

JCOBridge Coding simple example

Imagine you have the following Java Class:

public class MyJavaClass 
{
    //Static member
    static public String myStaticJavaHelloWorld()
    {
        return "Hello Static World from Java!!";
    }
    //Instance member
    public String myJavaHelloWorld()
    {
        return "Hello World from Java!!";
    }
    //Instance member
    public double myJavaAdd(double a, double b)
    {
        return a+b;
    }
}

you can call the previous Java class from C# using JCOBridge access to static and instance methods.

How to call Java code

Define a class that use the Java code:

class MyJavaUsingClass : SetupJVMWrapper
{
    public void Execute()
    {
        string hello = DynJVM.MyJavaClass.myStaticJavaHelloWorld();
        Console.WriteLine(hello); //Print "Hello Static World from Java!!"
        var myJavaClass = DynJVM.MyJavaClass.@new();
        hello = myJavaClass.myJavaHelloWorld();
        Console.WriteLine(hello); //Print "Hello World from Java!!"
        double result = myJavaClass.myJavaAdd(2.0, 3.0);
        Console.WriteLine("{1:0.0}",result); //Print "5.0"
    }
}

Add JCOBridge initialization before call the Execute method.

using MASES.LicenseManager.Common;
using MASES.JCBridge.C2JBridge;
using System;

static void Main(string[] args)
{
    MyJavaUsingClass JavaTest = new MyJavaUsingClass();
    JavaTest.Execute();
}

Other JCOBridge Examples

More information and more complex examples on www.jcobridge.com.
Meanwhile try the NuGet templates package with ready to use projects. NuGet JCOBridge Templates

Release Notes

Version 2.2.1:
- Removed the limitation to a single embeddable instance if the JavaUI control has its own message pump detached from main UI message pump
- Removed limitation on JCRefOut to single object: management of arrays now is a public feature
- Exposed internal API, on both JCType and JCObject, to interact with underlying System.Type and fields
- Solved minor issues.

Dependencies

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
2.2.1 279 6/3/2020
2.2.0 86 5/16/2020
2.1.0 90 4/15/2020
2.0.1 122 4/9/2020