MASES.JCOBridge 2.6.10

Prefix Reserved
dotnet add package MASES.JCOBridge --version 2.6.10
                    
NuGet\Install-Package MASES.JCOBridge -Version 2.6.10
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MASES.JCOBridge" Version="2.6.10" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MASES.JCOBridge" Version="2.6.10" />
                    
Directory.Packages.props
<PackageReference Include="MASES.JCOBridge" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MASES.JCOBridge --version 2.6.10
                    
#r "nuget: MASES.JCOBridge, 2.6.10"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MASES.JCOBridge@2.6.10
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MASES.JCOBridge&version=2.6.10
                    
Install as a Cake Addin
#tool nuget:?package=MASES.JCOBridge&version=2.6.10
                    
Install as a Cake Tool

JCOBridge

Java 8+

JCOBridge lets .NET and Java™/JVM™ code call each other in the same process.

Field proven

Built on top of the field-proven DLR plugin available in the Sinapse platform, JCOBridge is designed for high performance in the integration of the JVM and CLR worlds.

Supported platforms

  • .NET Framework 4.6.2+ (Windows only) and the .NET versions currently supported by Microsoft
  • Windows (x86/x64/Arm64), Linux (x64/Arm/Arm64) and macOS (x86_64/Aarch64)
  • Any JVM from 8 to latest
  • Other platforms, architectures and out-of-support .NET targets are available on request

Note: public releases follow the Microsoft .NET support lifecycle: when Microsoft ends support for a .NET version, that target is dropped starting with the next JCOBridge release.

Need a build for a legacy or out-of-support target, or expert help with .NET and JVM™ integration? See www.jcobridge.com.

Features

CLR

  • Retrieve a JVM Class, either directly or as in Java with the .class keyword
  • Instantiate JVM objects, either directly or using the dynamic feature of .NET
  • Invoke static methods, either directly on a previously retrieved Class or using dynamic
  • Invoke instance methods, either directly on a previously instantiated object or using dynamic
  • Get/Set static fields, either directly on a previously retrieved Class or using dynamic
  • Get/Set instance fields, either directly on a previously instantiated object or using dynamic
  • Use dynamic access to write code in a seamless way, as in Java
  • Use specific interfaces to manage methods and fields directly
  • Support classes to simplify bridging of Java classes from .NET
  • Send data back to the JVM from the .NET side upon events
  • Exceptions managed by the core and translatable into .NET exceptions
  • Management of user interface controls, properties and events
  • Integrate Java UI (AWT/Swing/SWT) into WPF/WinForms (from version 2.2)

JVM

  • Retrieve a CLR Type
  • Instantiate CLR objects
  • Invoke static methods on a previously retrieved Type
  • Invoke instance methods on a previously instantiated object
  • Get/Set static properties on a previously retrieved Type
  • Get/Set instance properties on a previously instantiated object
  • Set delegates
  • Subscribe/Unsubscribe events
  • Integrate WPF controls into an AWT/Swing window
  • Integrate WinForms controls into an AWT/Swing window
  • Integrate complex .NET graphical user interface objects into an AWT/Swing window
  • Management of user interface controls, properties and events

JCOBridge 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;
    }
}

JCOBridge lets you use the previous Java class from C#, both static and instance methods.

How to call Java code

Define a class that uses the Java code:

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

Create the class and 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 examples are available on the JCOBridge website.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed.  net11.0 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on MASES.JCOBridge:

Package Downloads
MASES.JNet

.NET suite for Java™/JVM™ - a comprehensive suite of libraries and tools to use Java™/JVM™ APIs (Java, Scala, Kotlin, ...) and .NET side-by-side

MASES.JCOReflectorEngine

JCOReflector Engine - JCOBridge based Java class generator that mimic .NET classes

GitHub repositories

This package is not used by any popular GitHub repositories.