Calling java method from C# .net
-
I have written a function in JAVA and i need to call that function from C# .net. While searching on the net, most of them suggesting to use 3rd party(like JNBridge) to create wrapper DLL and that can be referenced in C# .net. But i don't want to use 3rd party. How to develop a wrapper in order to access java from C#? Any example code may be more helpful.
-
I have written a function in JAVA and i need to call that function from C# .net. While searching on the net, most of them suggesting to use 3rd party(like JNBridge) to create wrapper DLL and that can be referenced in C# .net. But i don't want to use 3rd party. How to develop a wrapper in order to access java from C#? Any example code may be more helpful.
I'm afraid you'll need to have some form of bridge software. Have a read of this article[^], it explains the issues and gives you the software you need. Re-inventing the wheel is not a good idea.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
-
I have written a function in JAVA and i need to call that function from C# .net. While searching on the net, most of them suggesting to use 3rd party(like JNBridge) to create wrapper DLL and that can be referenced in C# .net. But i don't want to use 3rd party. How to develop a wrapper in order to access java from C#? Any example code may be more helpful.
now the question is not if or how a JAVA function can be called in C#. The real question must be: why? Why did you write "a function" in JAVA? Why didn't you write "a function" in C# as you are using C# surround "a function". And beside of that am I wondering what "a function" might be and why it is called directly from a C# code. Java can be a mighty beauty when written by an expert, but it needs a little more than "a function"-header to address a java code. Isn't there any network related stuff involved?
regards Torsten When I'm not working
-
I'm afraid you'll need to have some form of bridge software. Have a read of this article[^], it explains the issues and gives you the software you need. Re-inventing the wheel is not a good idea.
Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett
He's already got this answer on the C# forum. I think he has decided to go the JNI route and is looking for pointers on that so has re-posted here.
-
I have written a function in JAVA and i need to call that function from C# .net. While searching on the net, most of them suggesting to use 3rd party(like JNBridge) to create wrapper DLL and that can be referenced in C# .net. But i don't want to use 3rd party. How to develop a wrapper in order to access java from C#? Any example code may be more helpful.
This article may get you started: How to Call Java Functions from C Using JNI[^] It's a bit basic but it might at least point you in the right direction. But JNI programming is not straight-forward at the best of times, and the benefits of using a third-party tool are that they have worked out all the difficult bits, and it may end up being cheaper in the long run to buy something off the shelf than to spend ages building your own.
-
now the question is not if or how a JAVA function can be called in C#. The real question must be: why? Why did you write "a function" in JAVA? Why didn't you write "a function" in C# as you are using C# surround "a function". And beside of that am I wondering what "a function" might be and why it is called directly from a C# code. Java can be a mighty beauty when written by an expert, but it needs a little more than "a function"-header to address a java code. Isn't there any network related stuff involved?
regards Torsten When I'm not working
-
This article may get you started: How to Call Java Functions from C Using JNI[^] It's a bit basic but it might at least point you in the right direction. But JNI programming is not straight-forward at the best of times, and the benefits of using a third-party tool are that they have worked out all the difficult bits, and it may end up being cheaper in the long run to buy something off the shelf than to spend ages building your own.
-
Becoz JAVA has classes to support zip file compresion/decompression of multiple files. The same feature is not available in C#. Only through 3rd party its achivable. So i prefer to write a dll in java and use it in C#. Is there any alternate solutions?
one can not zip multiple files in C#??? :omg: Not really true eh! Think about it. This MUST be possible. Ask the C# guys. Using some Java code found on the web in a C# environment can't be a solution.
regards Torsten When I'm not working