views:

83

answers:

3

Hi all,

I just want to call a java function from ASP.Net... Please guide me !!!

I have seen JNBridge but its not free... :(

Thanks in anticipation

+1  A: 

and why you wanna do that?

1- It will slow your code also as Plateform Conversion came into picture

2- It will make your code hard to test.

3- It will make your code hard to understand.

There must be very solid reason because what ever you can do with Java , you can do in C#

if possible you can always COPY & PASTE same function in ASP.Net application

saurabh
if it's just one function, sure, port it, but if it's a big thing... porting isn't always feasible.
Mark
ya you are right.. but i am using java's open source project.net (integration project.net in my website) !!! they have a password encryption function and in order to do single sign on i have to do the same encryption in my website.
xtremist
getting code from java and convert it in to C# is simple but what if they (project.net community) changed its encryption logic (as it is a open source) in future ... :( for that i have to always check project.net updates..
xtremist
+2  A: 

Not sure if it's exactly what you are looking for, but you could check out IKVM.NET.

patmortech
+2  A: 

Possible options that i can think of :-

  1. Expose the java function's functionality through a service (Recommended - Loosely Coupled)

  2. Integrate through backend eg: database. Both programs can access a common database and pass data through here. (Not Highly Recommented - Very Tightly Coupled)

  3. Use an open source bridge eg : jni4net

Note: I have not used this bridge ever but it seems to be something similar to what you are looking for. Refer their sample here

InSane
Thanks InSane, i am studying jni4net and will update you if i get an face any issue.
xtremist
ya you are right ... there are lots of encryption algorithms but project.net (java provided open source) has its own function to encrypt provided password ... to make things in sync i want that function in my C# website...
xtremist
@xtremist - I would go with my first option if i were you. As i understand it, you can very easily create a web service wrapper and expose the necessary function from project.net. Then you can just call this service from your .NET code. That would still be my preferred way over using a bridge!!
InSane
yes i am doing this through service ... Thanks to guide me InSane.
xtremist