What is the best way to interface C# and Java? [closed]

Hypothetically, you have two products, one written in Java, the other in C#. You like the Java based backend (non-user visible portion), but would like to use the C# (WPF) frontend. What is the best way to go about interfacing them?

Note that the backend must be able to run on either a server or on the local machine and the frontend should be able to connect to either one.

My first thoughts were to use something like Ice, or maybe a webservice.

And Go!

Edit

Converting the code or running it in some variety of neutral VM (IKVM) is not an option.


Asked by: Carlos768 | Posted: 21-01-2022






Answer 1

Web services should be your default choice because there is so much work around interoperability in that space.

If you don't mind tight coupling, and must make performace based decisions, two solutions I have encountered are:

I'm sure there are others.

Answered by: Briony153 | Posted: 22-02-2022



Answer 2

While Web Services (WS-*) might be the correct solution, getting stacks to interoperate can be kludgy.

There is much to be said for HTTP + (POX | JSON) and REST-ian architecture.

Answered by: Sienna243 | Posted: 22-02-2022



Answer 3

Expose a web service on the java backend and have the C# front end talk to the java web service. Look into WCF (windows communication foundation) it might make talking to a java web service alot easier.

Answered by: Kellan532 | Posted: 22-02-2022



Answer 4

You could use webservices.

Or you could use IVKM to embed the java code directly into a .NET assembly.

Answered by: Ned994 | Posted: 22-02-2022



Answer 5

I've worked on the java back-end to a C# rich-client. They communicated via web-services alright. The only problem we really had was with inheritance hierarchies, which web-services WSDLs erase.

Answered by: Thomas133 | Posted: 22-02-2022



Answer 6

I do believe there are some interoperability issues using Web Services across Java/.NET platforms. For instance there are some problems using Axis2 and .net together. In most cases workarounds exists.

I've heard some good comments about using REST-ian architecture though.

Answered by: Justin587 | Posted: 22-02-2022



Answer 7

There are several methods for creating/obtaining interoperability between java and .net systems.

  • Web services
  • Visual J#
  • Java Native Interface (JNI)
  • BytecodeTranslation
  • Runtime Bridges

Web Services are most commonly used. Web services mostly use a SOAP-based communications mechanism that may be inherently slower than alternative binary communications mechanisms. Web services are also not well-suited for passing custom objects between Java and .NET as parameters and return values.

This article gives really good overview on what is what:

http://www.devx.com/interop/Article/19945

Answered by: Aldus286 | Posted: 22-02-2022



Similar questions

Why? The best way to code with interface in java?

This question already has answers here:


oop - Is a Java interface an abstract class?

This question already has answers here:


java - Need for Abstract Class as well as Interface?

An interface is a 100% abstract class, so we can use an interface for efficient programming. Is there any situation where an abstract class is better than an interface?


java - Why doesn't this generic interface stack work?

I have a bunch of generic interfaces and classes public interface IElement { // omited } class Element implements IElement { // omited } public interface IElementList<E extends IElement> extends Iterable { public Iterator<E> iterator(); } class ElementList implements IElementList<Element> { public Iterator<Element> iterator() { // omited } } public interfa...


user interface - Java GUI repaint() problem?

I have a JFrame. This JFrame contains a JButton. I click the JButton and 10 JTextFields are created. the problem: I cannot see them until "I force a repaint()" by resizing the window. Only then do I see the JTextFields created. CODE: JPanel points = new JPanel(); //Creating the JTextFields: for (int i=0; i<10; i++) { JTextField textField = new JTextField(); points.add(textField);...


java - How to discover the type of the NAT a given interface is behind

I would like to discover the type of the NAT (FullCone, Restricted Cone, Port Restricted cone, Symmetric) a given network interface is behind. I've tested different tools (http://freshmeat.net/projects/jstun/, http://code.google.com/p/boogu/) but they report differen...


user interface - Java GUI - General

Closed. This question does not meet Stack Overflow guid...


java - How to have JMX bind to a specific interface?

I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine. In our environment, there are often cases where there is more than one Java VM running on a machine at the same time. While it's possible to tell JMX to ...


Java: Adding a User Interface to a program

If I have Java program and I need to alter it to an interface and include icons, is there any easy I can do this and is there a good application that can help me to do it ? or do I have to code it in myself?


swing - How to design interface for a game in Java

We're a team of a designer and a programmer. Me, the programmer, is hopeless on design of all sorts, so the user interface of the game must be created by the designer. We were thinking of a main screen, where the character walks around, a small minimap in the top, an inventory section, etc. All these things would have to be designed in a way that looks pretty, i.e nice graphics/buttons/colors etc. I'm assuming that...


java - Is there more to an interface than having the correct methods

So lets say I have this interface: public interface IBox { public void setSize(int size); public int getSize(); public int getArea(); //...and so on } And I have a class that implements it: public class Rectangle implements IBox { private int size; //Methods here } If I wanted to use the interface IBox, i can't actually create an instance ...






Still can't find your answer? Check out these amazing Java communities for help...



Java Reddit Community | Java Help Reddit Community | Dev.to Java Community | Java Discord | Java Programmers (Facebook) | Java developers (Facebook)



top