-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: bsunil_net
Message 1 in Discussion

Hi,

Good evening.I have a query i.e how to call Java program from  .net.So i searched in 
google and
found JNbridge.I downloaded jnbridge software and tried to do some small 
experiment.But unfortunately i face few problems.

I have created a windows form with 3 text boxes and one button.First two textboxes to 
enter some numbers when you click the button it has sum both and put into the third 
textbox

Ex:

   First  N0:12
   Second No:13

   Result   :25   

    Submit   // this button

To add i written add method in java i want to call the same.This is my requirement.

when i click button i used the following code

int n1,n2,result;
Addjava a = new AddJava();
n1 = Int32.Parse(textBox1.Text);
n2 = Int32.Parse(textBox2.Text);
result = a.add(n1,n2);
textBox3.Text = result.ToString();

Java file will be

public class AddJava
{
        public int add(int a ,int b)
        {
                int result;
                result = a+ b;
                return result;
        }
}

First i compiled java file.Using jnbridge i created the dll and added the references 
to the project AddJava.dll.It asked one more dll to add i.e JNBShare.dll i have added 
the same.

Compilation went through fine but failing in execution.
To do this program Remoting is essential ? If yes than why ?

The sample example they are using remoting so i copied all the files to the related 
directories and executed.I am facing the following error when i create a object of 
java class.

creating binary server
A communications error was encountered.
If this error persists, please contact [EMAIL PROTECTED]

java.net.SocketException: Connection reset by peer: socket write error
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(Unknown Source)
        at java.net.SocketOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
        at java.io.BufferedOutputStream.flush(Unknown Source)
        at com.jnbridge.jnbcore.c.b.g.a(Unknown Source)
        at com.jnbridge.jnbcore.c.b.h.goto(Unknown Source)
        at com.jnbridge.jnbcore.c.b.h.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Can anybody faced this problem before ? If yes provide me your suggestion else give 
some URLs where 
i can get good example about communication from .net to java and vice versa.

Regards,
Sunil

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/bdotnet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to