• Post Reply Bookmark Topic Watch Topic
  • New Topic

Connecting .NET dll to JAVA?  RSS feed

 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm wondering if it is possible to use .NET dll file in your JAVA application?
Is there a way to connect .NET to JAVA??

The company that I work with is trying to evaluate a vendor product that is only available in .NET framework, but everything in our side is Open Source and we use mostly JAVA. So I'm not sure if we still can go ahead with this evaluation or not.

Thanks in advance for all the advice.
 
Jon Parise
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that with JNI you can connect Java to C/C++, but I am not sure if it would work for your DLL. I have very little experience with JNI, but it might be worth looking into.

I'm too am interested in getting .Net DLLs and Java to play nice because some of the drivers my company needs for our communications are only written in .Net. I am trying to move them away from .Net as it keeps turning out to be very expensive for our small company, but without those drivers we are stuck.

I hope you can figure this out, if you do let us all know.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there are third party tools / libraries that will help you connect Java to .NET. If you want to do it youself -- meaning implement the JNI wrappers yourself -- you actually need to implement 2 sets of wrappers.

JNI will get you to C/C++, which is not allowed to directly access .NET objects. At that point, you can implement another wrapper, a .NET object with only static methods, that your C/C++ wrapper can call. Since unmanaged C/C++ code can't own .NET objects, it can only call static methods of .NET classes.

Henry
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, there are third party tools / libraries that will
help you connect Java to .NET

Henry, could you give some recommendations for this?
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Susan Smith:

Henry, could you give some recommendations for this?


Unfortunately no. We were about to evaluate a couple of products, but then decided to just implement it ourselves, with JNI. It was for a small demo, and the time to write the two (small and simple) wrappers, was about the same as doing the evaluation.

Henry
 
Susan Smith
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. So JNI might the better solution for me too. I don't know anything about JNI, can you recommend me good sources to help me up to speed with JNI?
Especially in relation to .NET

Thanks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!