mstaal
mstaal

Reputation: 630

Is it possible to invoke a .NET Core app in Java?

I have a .NET Core (console) app that I would like for a Java app to depend on. Essentially I would like to be able for the Java app to invoke a multi variable method in the .NET Core app and then pass the result back to the Java app. It would be nice if the .NET Core app could be embedded in the Java app. I have previously seen .NET Framework specific solutions to this problem, but since this would only be relevant on Windows, I would like a solution that also works on Linux.

Upvotes: 3

Views: 2595

Answers (2)

domusmagister
domusmagister

Reputation: 167

From my actual knowledge this nuget package JCOBridge is able to do what you are asking for. Until now it supports linux for x64 architecture. I tried the templates available on Templates and them works on my Ubuntu 18.04. The same templates works on Windows.

Upvotes: 0

Christopher Painter
Christopher Painter

Reputation: 55601

In the past there were some technologies such as IKVM.NET and COM Interop wrappers but the former is defunct and the latter probably wouldn't work on Linux.

Since you own the .net core code, I would take a more modern microservice approach. I would design the .net core app to be a REST API running as a console app listening on a port. I'd have the Java application spin up the console app, invoke the methods passing JSON back and forth and then spit it down when complete.

Upvotes: 1

Related Questions