Calling Java Code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim

    #1

    Calling Java Code

    Can you call exisiting Java classes from C#?
  • Coatl

    #2
    Re: Calling Java Code

    Nop, only if this classes were developed under the .NET Platform using J#.
    There are several options to achive interoperabilit y between J2EE and .NET
    Applications, this depends in the scenario. (Servlets, EJB, JSP, JPO, etc)

    There is an incoming book in the Patterns and Practices series:

    http://www.microsoft.com/resources/practices/coming.asp

    And there is always the option to migrate the code:

    http://msdn.microsoft.com/library/en...ngjavaapps.asp

    --
    Alberto Borbolla
    Microsoft MVP
    WebLog:



    "Jim" <James.Swarthou t@infousa.com> wrote in message
    news:0a9901c3b9 de$79cd45c0$a00 1280a@phx.gbl.. .[color=blue]
    > Can you call exisiting Java classes from C#?[/color]


    Comment

    • James Black

      #3
      Re: Calling Java Code

      Jim wrote:
      [color=blue]
      > Can you call exisiting Java classes from C#?[/color]

      Is it written in MSs Java (I think it is J#)? If so then you might be
      able to (I have never done it that).

      You can execute it as a program if nothing else.

      I don't know what you mean by call a java class, that is somewhat vague.

      Comment

      • Bruno Jouhier [MVP]

        #4
        Re: Calling Java Code

        If it was written in MS Java, it was probably written with Visual J++ rather
        than Visual J#. So, you would need to take your source code and recompile it
        with Visual J#. This will give you .NET assemblies that you will be able to
        reference from your C# project, like any .NET assembly.

        Visual J# offers very good source code compatibility with Visual J++, so
        this should be rather seamless. Story would be a bit different if your Java
        source was based on SUN's latest JDK.

        Bruno

        "James Black" <jblack@ieee.or g> a écrit dans le message de
        news:eGvVnFeuDH A.2432@TK2MSFTN GP10.phx.gbl...[color=blue]
        > Jim wrote:
        >[color=green]
        > > Can you call exisiting Java classes from C#?[/color]
        >
        > Is it written in MSs Java (I think it is J#)? If so then you might be
        > able to (I have never done it that).
        >
        > You can execute it as a program if nothing else.
        >
        > I don't know what you mean by call a java class, that is somewhat[/color]
        vague.[color=blue]
        >[/color]


        Comment

        • bvh

          #5
          Re: Calling Java Code

          depending on the format of what you're trying to do, you can
          use XMLRPC to do it.

          Here is an xmlrpc class for C#. I haven't used it so I can't say
          whether or not its any good.



          Of course this is appropriate if you are working on a web based
          project, or at very least a client server project and the
          procedure call doesn't involve something fancy like renering
          a SWING interface, but rather is a simple object oriented method
          call. For example if you have business rules in a Java object
          and no time or inclination to rework them into C#.

          Of course, SOAP is another option along the same lines, but
          IMHO XMLRPC is less work than SOAP because the guts of the
          request are typically handled for you.


          On Wed, 03 Dec 2003 12:46:07 -0800, Jim wrote:
          [color=blue]
          > Can you call exisiting Java classes from C#?[/color]

          Comment

          • JDeats

            #6
            Re: Calling Java Code

            C# code compiles for and targets the .NET Framework CLR, Java code
            targets JVM. Both are virtual machines that sit on top of the native
            OS, they both follow very different binary standards for interfaces.
            In order to have true interop between the two you'd need a virtual
            machine that can marshall calls between the two platforms at a binary
            level. I don't know of any software that does this, but there probably
            is something on the market.

            The other option (and the one that's already been recommendend) is the
            more common approach, which is to use Web Services on the Java end and
            the .NET side to marhsall the calls. This was (at least in part) the
            whole point of web services and XML itself- to allow disjoined systems
            the ability to communicate with one another.




            "Jim" <James.Swarthou t@infousa.com> wrote in message news:<0a9901c3b 9de$79cd45c0$a0 01280a@phx.gbl> ...[color=blue]
            > Can you call exisiting Java classes from C#?[/color]

            Comment

            • Wayne Citrin

              #7
              Re: Calling Java Code

              Jim --

              You can call Java classes from C# through our Java/.NET interoperabilit y
              tool, JNBridgePro. See www.jnbridge.com for more information, or contact me
              for details.

              JNBridgePro is one of the solutions featured in the Patterns and Practices
              book mentioned below.

              Regards,
              Wayne
              _______________ _______________ ______

              Wayne Citrin
              JNBridge, LLC
              citrin@NoSpam_j nbridge.com (remove anti-spam text in e-mail before replying)
              JNBridge connects Java and .NET applications so enterprise teams can reuse existing code, call Java from C# or .NET from Java, and modernize without rewrites.

              Spanning the Worlds of Java and .NET
              _______________ _______________ ______

              "Coatl" <Xcoatl@mvps.or g> wrote in message
              news:OKD0JFeuDH A.2308@TK2MSFTN GP09.phx.gbl...[color=blue]
              > Nop, only if this classes were developed under the .NET Platform using J#.
              > There are several options to achive interoperabilit y between J2EE and .NET
              > Applications, this depends in the scenario. (Servlets, EJB, JSP, JPO, etc)
              >
              > There is an incoming book in the Patterns and Practices series:
              >
              > http://www.microsoft.com/resources/practices/coming.asp
              > Alberto Borbolla
              > Microsoft MVP
              >
              > "Jim" <James.Swarthou t@infousa.com> wrote in message
              > news:0a9901c3b9 de$79cd45c0$a00 1280a@phx.gbl.. .[color=green]
              > > Can you call exisiting Java classes from C#?[/color]
              >
              >[/color]


              Comment

              Working...