Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Integrating JAVA and C#

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Integrating JAVA and C#

    Hi all,


    Please I need some help to choose the best way to integrate a main project in JAVA with a program write in C#, this is the situation :

    The main JAVA project is an interface and it will capture an image from a microscope......I will manipulate this image in the C# program ( filters) and then return the manipulated image.


    The methods that i found to integrate : JNI/JNA/WEBSERVICE


    It will work in a LINUX system so another point is what is the best way to go? Try integrate or convert both programs to C++ language (since to use C# we need use MONO and i dont know the compatibility issues that will happen)


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: Integrating JAVA and C#

    Hopefully Freaky Chris will see this thread as he is the JNI guru
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Senile Half-Wit Freaky Chris's Avatar
    Join Date
    Mar 2009
    Posts
    834
    My Mood
    Cynical
    Thanks
    7
    Thanked 105 Times in 90 Posts

    Default Re: Integrating JAVA and C#

    Hey ckask, if you are requiring it to be run on a linux System then I would reccomend two approaches, one would be as you suggested merge both of the programs into C++, the other would be both into Java.

    Before you decide on how you are going to transfer data from one application to another, its probably best that you look at how you data is stored. For example, good luck sending a BufferedImage object from Java to C/C++, as far as I'm aware there is no support for this through JNI.

    Once you have a data structure and you have decided on the approach you are going to take for languages for the applications, then we could discuss a solution to your problem.

    Hopefully, I've given you something to think about here

    Chris

  4. The Following User Says Thank You to Freaky Chris For This Useful Post:

    JavaPF (February 5th, 2011)

  5. #4
    Member
    Join Date
    Jul 2010
    Location
    Washington, USA
    Posts
    307
    Thanks
    16
    Thanked 43 Times in 39 Posts

    Default Re: Integrating JAVA and C#

    I have an idea. Use Java to take the picture from the microscope, hava java export it to "temp.png" (Or any other suitable name) use Java process builder to run your C# app with the image name as an argument, then have C# do its image filter stuff and overwrite temp.png with the new data, finally have Java finish up with the complete image.

  6. #5
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Integrating JAVA and C#

    Use webservices, that will solve your problems just fine and be cross platform compatible for you as well. Avoid JNI if possible.

    // Json