Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 2.91 KB

README.md

File metadata and controls

65 lines (46 loc) · 2.91 KB

Java.Interop

Java.Interop is a binding of the Java Native Interface for use from managed languages such as C#, and an associated set of code generators to allow Java code to invoke managed code.

This allows one to bridge code running on .NET's CLR and code running on a Java VM.

Note this does not mean that one can run Java code on .NET, or vice-versa.

Java.Interop currently does not ship independently. It is shipped as part of Microsoft's .NET for Android product, available via Visual Studio or .NET 6+. However, it is designed to be fully independent of Android and should be usable by other Java implementations. For other uses, please compile and distribute from source.

Some additional context for this project is documented in the Motivation and Architecture pages.

Building

  • The standalone tooling and test target framework on main is .NET 11, available here.
  • The release/6.0.3xx branch is configured to build with .NET 6.

The standalone tooling build does not require a locally built Android SDK. For the Android product build, follow the enclosing repository's build instructions. Libraries and command-line tools live in the repository's top-level src/, tooling tests in tests/, and the JNI source generator in build-tools/java-interop-jnienv-gen/. There is no separate bootstrap project or Java.Interop preparation step. Java.Interop projects are included in Microsoft.Android.slnx. To build just the generator tooling and its tests, use the solution filter from the repository root:

dotnet build src/generator/generator.slnf

JNI unions and native structs use ExtendedLayout with CUnion and CStruct, requiring .NET 11 or later.

Additional build options are documented here.

Feedback and Contributing

This project welcomes issues and PRs.

License

Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.