JavaNative.Win32Metadata
25.0.1
dotnet add package JavaNative.Win32Metadata --version 25.0.1
NuGet\Install-Package JavaNative.Win32Metadata -Version 25.0.1
<PackageReference Include="JavaNative.Win32Metadata" Version="25.0.1" />
<PackageVersion Include="JavaNative.Win32Metadata" Version="25.0.1" />
<PackageReference Include="JavaNative.Win32Metadata" />
paket add JavaNative.Win32Metadata --version 25.0.1
#r "nuget: JavaNative.Win32Metadata, 25.0.1"
#:package JavaNative.Win32Metadata@25.0.1
#addin nuget:?package=JavaNative.Win32Metadata&version=25.0.1
#tool nuget:?package=JavaNative.Win32Metadata&version=25.0.1
JavaNative.Win32Metadata
This project contains code to build and publish the JavaNative.Win32Metadata nuget package. The package wraps the Java Native Interface library into a winmd (Windows metadata) file. If you combine it with Microsoft.Windows.CsWin32, it will allow you to generate signatures (PInvokes) to easily use .NET Host functions in your executable/library.
How to use it
Install the required Nuget packages:
Create a
NativeMethods.txtfile in the root folder of your project and list native functions and structures (including the one from JNI) you plan to use, for example:// Windows LoadLibrary // Java Native Interface JNI_TRUE JNI_CreateJavaVM JNI_GetDefaultJavaVMInitArgsPlease also check the CSWin32 project README file for other configuration options of the PInvoke generators.
You are ready to use the native functions in your code 😃
using FreeLibrarySafeHandle __ = PInvoke.LoadLibrary($"{Environment.GetEnvironmentVariable("JAVA_HOME")}/bin/server/jvm.dll"); JavaVMInitArgs vm_args = new() { version = JNI_VERSION.JNI_VERSION_24 }; _ = Java.PInvoke.JNI_GetDefaultJavaVMInitArgs(ref vm_args); JNI_ERROR result = Java.PInvoke.JNI_CreateJavaVM(out JavaVM* jvm, out JNIEnv* env, vm_args);
Contributors
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- 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 | Downloads | Last Updated |
|---|---|---|
| 25.0.1 | 41 | 1/28/2026 |