jni4net | object oriented , intraprocess bridge | Runtime Evironment library
kandi X-RAY | jni4net Summary
kandi X-RAY | jni4net Summary
Fast, object oriented, intraprocess bridge between JVM and CLR
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of jni4net
jni4net Key Features
jni4net Examples and Code Snippets
Community Discussions
Trending Discussions on jni4net
QUESTION
Can I add .JAR file as a library in my C# project? If I can do that it will help me to save writing duplicate codes for JAVA & for C#.
I looked at "https://github.com/jni4net/jni4net/" but didn't get the answer if I can really called the API written in .JAR files.
Thanks in Advance!
...ANSWER
Answered 2022-Feb-16 at 22:19I was able to use JAR file in C# after converting it into DLL using ikvm. Here's the steps I followed:
- Download the latest version of iKVM from https://sourceforge.net/projects/ikvm/ & Unzip the zip file.
- Open command prompt in windows and run this command: ikvmc.exe -out:.dll .jar
- Above steps should generate the DLL which you can reference in C# project.
There is also another way using JNI4NET - https://github.com/jni4net/jni4net/ but I haven't explored it much as I was able to achieve what I want using iKVM
Happy Coding!
Thanks
QUESTION
I'm building a REST API with ASP.NET, which should ideally be able to use Java code. I've already managed to create a bridge between .NET and Java by using jni4net in a simple console application. This is absolutely necessary due the non-existing interoperability of .NET and Java.
Nevertheless I can't create a bridge in my ASP.NET project by using jni4net. Apparently this is a common error due the fact that .NET core 2.1 or later versions do not support the methods shown below. I am refering to this question: "Error in the webapp while connecting with JVM using jni4net from C#".
MissingMethodException: Method not found: 'System.Reflection.Emit.AssemblyBuilder System.AppDomain.DefineDynamicAssembly(System.Reflection.AssemblyName, System.Reflection.Emit.AssemblyBuilderAccess)'.
Note that I'm using .NET core 3.1 for my ASP.NET project and jni4net 0.8.8.0. Anyways I'm would change my .NET version if needed. My current implementation in Program.cs looks like this:
...ANSWER
Answered 2021-Dec-03 at 11:21As far as I know jni4net is not compatible with .NET Core. It's for .NET Framework.
This is absolutely necessary due the non-existing interoperability of .NET and Java. I don't know the circumstances but it shouldn't be a necessity. Just build a service that exposes API to C# code. Voila you have a bridge. Or you can use CORBA however it's so complex it doesn't worth at all imo.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jni4net
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page