reference .NET assembly in JAVA assembly

Discussion in 'Java' started by doomsday123@gmail.com, Jan 24, 2007.

  1. Guest

    I was wondering if I could reference a .NET assembly inside of a JAVA
    assemble for use. I am using one of the .NET internal assemblies and
    dont want figure out how to do the same thing in JAVA so i want to just
    call the .NET assembly and use that method in my java code.
     
    , Jan 24, 2007
    #1
    1. Advertising

  2. In article <>, wrote:
    > I was wondering if I could reference a .NET assembly inside of a JAVA
    > assemble for use. I am using one of the .NET internal assemblies and
    > dont want figure out how to do the same thing in JAVA so i want to just
    > call the .NET assembly and use that method in my java code.


    JNI is your friend. JNI lets you call any native code, whether Win32
    or .NET code on a Windows box (in a DLL) or shared library code on an
    *ix system. Google will help you find tutorials, etc. on JNI.


    --
    Steve Sobol, Professional Geek ** Java/VB/VC/PHP/Perl ** Linux/*BSD/Windows
    Victorville, California PGP:0xE3AE35ED

    It's all fun and games until someone starts a bonfire in the living room.
     
    Steven J. Sobol, Jan 24, 2007
    #2
    1. Advertising

  3. wrote:
    > I was wondering if I could reference a .NET assembly inside of a JAVA
    > assemble for use. I am using one of the .NET internal assemblies and
    > dont want figure out how to do the same thing in JAVA so i want to just
    > call the .NET assembly and use that method in my java code.


    The best thing would be to rewrite.

    The second best would to run two processes one Java and one .NET
    and then use socket between them.

    If you need to run both in same process, then look at:
    - IKVM (open source) for running Java in .NET CLR
    - Grasshopper (commercial) to run .NET code in JVM (JEE container)

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jan 25, 2007
    #3
  4. Steven J. Sobol wrote:
    > In article <>, wrote:
    >> I was wondering if I could reference a .NET assembly inside of a JAVA
    >> assemble for use. I am using one of the .NET internal assemblies and
    >> dont want figure out how to do the same thing in JAVA so i want to just
    >> call the .NET assembly and use that method in my java code.

    >
    > JNI is your friend. JNI lets you call any native code, whether Win32
    > or .NET code on a Windows box (in a DLL) or shared library code on an
    > *ix system. Google will help you find tutorials, etc. on JNI.


    On Windows JNI can call code in a Win32 DLL with native code.

    It can not call code in a .NET assembly.

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jan 25, 2007
    #4
  5. Arne Vajhøj wrote:
    > wrote:
    >> I was wondering if I could reference a .NET assembly inside of a JAVA
    >> assemble for use. I am using one of the .NET internal assemblies and
    >> dont want figure out how to do the same thing in JAVA so i want to just
    >> call the .NET assembly and use that method in my java code.

    >
    > The best thing would be to rewrite.
    >
    > The second best would to run two processes one Java and one .NET
    > and then use socket between them.
    >
    > If you need to run both in same process, then look at:
    > - IKVM (open source) for running Java in .NET CLR
    > - Grasshopper (commercial) to run .NET code in JVM (JEE container)


    My reply to sobol made me remember a third option:

    Java---(JNI)---Win32 DLL with native code---(COM)---.NET assembly

    But if you don't know how to call COM components from C++, then it
    is not trivial.

    Arne
     
    =?ISO-8859-1?Q?Arne_Vajh=F8j?=, Jan 25, 2007
    #5
  6. Vitaly Guest

    See Object-Oriented JNI SDK for .NET v.1.1, v.2.0

    http://www.simtel.net/product.php[id]95126[sekid]0[SiteID]simtel.net
    http://www.simtel.net/product.php[id]98653[SiteID]simtel.net

    This is a map of Regular JNI for C++ to .NET. Supports bi-directional
    calls,
    Java native method implementation with
    System.load(...)/System.loadLibrary(...), etc.

    Regards,
    Vitaly Shelest


    <> wrote in message
    news:...
    >I was wondering if I could reference a .NET assembly inside of a JAVA
    > assemble for use. I am using one of the .NET internal assemblies and
    > dont want figure out how to do the same thing in JAVA so i want to just
    > call the .NET assembly and use that method in my java code.
    >




    I'm protected by SpamBrave
    http://www.spambrave.com/
     
    Vitaly, Jan 28, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Prasanna Padmanabhan
    Replies:
    1
    Views:
    820
    Mattias Sjögren
    Nov 19, 2003
  2. SA
    Replies:
    0
    Views:
    477
  3. Horatiu Margavan via .NET 247

    Assembly's manifest definition does not match the assembly reference.

    Horatiu Margavan via .NET 247, Aug 30, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    3,611
    Horatiu Margavan via .NET 247
    Aug 30, 2004
  4. Monty
    Replies:
    2
    Views:
    502
    Walter Wang [MSFT]
    Jun 6, 2007
  5. JB
    Replies:
    0
    Views:
    949
Loading...

Share This Page