2

I have written some classes in C# and compiled it. Now I have the library file for these classes. Can I use the same dll with Java?

I do not want to write it in Java once again because I am writing the same program in different languages (trying to do so).

So I am making the classes to a library file and want to use it in all the programing languages.

3 Answers 3

3

Java normally uses a completely different runtime (inside the JVM). There are tools intending to help bridge the gap (IKVM leaps to mind), but in general: no, you can't do this. Of course, you can use IPC etc to talk between them, but they are not best friends.

Sign up to request clarification or add additional context in comments.

Comments

1

One area you can look into is JNI (Java Native Interface), see http://en.wikipedia.org/wiki/Java_Native_Interface as a starting point. There are possibly easier to use bridges for .NET to Java, ah here we go, see Calling C# code from Java?

Comments

1

You need to searialize your code into byte, xml or json. so you can use your codes in another language

1 Comment

"searialize your code into byte, xml or json" ? how to serialize a C# function into json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.