简体   繁体   中英

can use a library created in vb.net or c# in java?

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.

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.

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

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM