Skip to content

Repository files navigation

J2NET

Nuget
Provides an environment for running Java in .NET

Support

PlatformArchitecturePackage
macOSIntel (X64)J2NET.Runtime.macOS-x64
macOSApple Silicon (ARM64)J2NET.Runtime.macOS-arm64
LinuxX64J2NET.Runtime.linux-x64
LinuxARM64J2NET.Runtime.linux-arm64
AlpineX64J2NET.Runtime.linux-musl-x64
AlpineARM64J2NET.Runtime.linux-musl-arm64
WindowsX64J2NET.Runtime.win-x64

Getting Started

1. Install NuGet package

Install the latest version of the J2NET package from NuGet.

2. Add Runtime package reference

Paste the following XML into your Project(.csproj / .vbproj / .fsproj) file.

<PropertyGroup>
<RuntimeVersion>1.4.0</RuntimeVersion>
<OSPlatformCondition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">OSX</OSPlatform>
<OSPlatformCondition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">Linux</OSPlatform>
<OSPlatformCondition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">Windows</OSPlatform>
<OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</OSArchitecture>
</PropertyGroup>
<ItemGroup>
<PackageReferenceCondition=" '$(OSPlatform)' == 'OSX' And '$(OSArchitecture)' == 'X64' "Include="J2NET.Runtime.macOS-x64"Version="$(RuntimeVersion)" />
<PackageReferenceCondition=" '$(OSPlatform)' == 'OSX' And '$(OSArchitecture)' == 'ARM64' "Include="J2NET.Runtime.macOS-arm64"Version="$(RuntimeVersion)" />
<PackageReferenceCondition=" '$(OSPlatform)' == 'Linux' And '$(OSArchitecture)' == 'X64' "Include="J2NET.Runtime.linux-x64"Version="$(RuntimeVersion)" />
<PackageReferenceCondition=" '$(OSPlatform)' == 'Linux' And '$(OSArchitecture)' == 'ARM64' "Include="J2NET.Runtime.linux-arm64"Version="$(RuntimeVersion)" />
<PackageReferenceCondition=" '$(OSPlatform)' == 'Windows' And '$(OSArchitecture)' == 'X64' "Include="J2NET.Runtime.win-x64"Version="$(RuntimeVersion)" />
<PackageReferenceCondition=" '$(OSPlatform)' == 'Windows' And '$(OSArchitecture)' == 'X86' "Include="J2NET.Runtime.win-x86"Version="$(RuntimeVersion)" />
</ItemGroup>

3. Run the Code!

varprocess=JavaRuntime.ExecuteJar("../../../Sample/Sample.jar");process.WaitForExit();

About

Provides an environment for running Java in .NET

Topics

Resources

Stars

18 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages