Skip to content

chequer-io/J2NET

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

J2NET

Nuget
Provides an environment for running Java in .NET

Support

Platform Architecture Package
macOS Intel (X64) J2NET.Runtime.macOS-x64
macOS Apple Silicon (ARM64) J2NET.Runtime.macOS-arm64
Linux X64 J2NET.Runtime.linux-x64
Linux ARM64 J2NET.Runtime.linux-arm64
Alpine X64 J2NET.Runtime.linux-musl-x64
Alpine ARM64 J2NET.Runtime.linux-musl-arm64
Windows X64 J2NET.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>
    <OSPlatform Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">OSX</OSPlatform>
    <OSPlatform Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">Linux</OSPlatform>
    <OSPlatform Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))' == 'true'">Windows</OSPlatform>
    <OSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::ProcessArchitecture)</OSArchitecture>
</PropertyGroup>

<ItemGroup>
    <PackageReference Condition=" '$(OSPlatform)' == 'OSX' And '$(OSArchitecture)' == 'X64' " Include="J2NET.Runtime.macOS-x64" Version="$(RuntimeVersion)" />
    <PackageReference Condition=" '$(OSPlatform)' == 'OSX' And '$(OSArchitecture)' == 'ARM64' " Include="J2NET.Runtime.macOS-arm64" Version="$(RuntimeVersion)" />
    <PackageReference Condition=" '$(OSPlatform)' == 'Linux' And '$(OSArchitecture)' == 'X64' " Include="J2NET.Runtime.linux-x64" Version="$(RuntimeVersion)" />
    <PackageReference Condition=" '$(OSPlatform)' == 'Linux' And '$(OSArchitecture)' == 'ARM64' " Include="J2NET.Runtime.linux-arm64" Version="$(RuntimeVersion)" />
    <PackageReference Condition=" '$(OSPlatform)' == 'Windows' And '$(OSArchitecture)' == 'X64' " Include="J2NET.Runtime.win-x64" Version="$(RuntimeVersion)" />
    <PackageReference Condition=" '$(OSPlatform)' == 'Windows' And '$(OSArchitecture)' == 'X86' " Include="J2NET.Runtime.win-x86" Version="$(RuntimeVersion)" />
</ItemGroup>

3. Run the Code!

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

About

Provides an environment for running Java in .NET

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 8