Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. How can we call c++ functions by using java code

How can we call c++ functions by using java code

Scheduled Pinned Locked Moved Java
c++javaquestion
6 Posts 3 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sankardunga
    wrote on last edited by
    #1

    Dear sir, I have collection of c++ classes,I want use them into my java application. What is the best method to do this. regards sankar

    L J 2 Replies Last reply
    0
    • S sankardunga

      Dear sir, I have collection of c++ classes,I want use them into my java application. What is the best method to do this. regards sankar

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You need to use the Java Native Interface[^].

      I must get a clever new signature for 2011.

      1 Reply Last reply
      0
      • S sankardunga

        Dear sir, I have collection of c++ classes,I want use them into my java application. What is the best method to do this. regards sankar

        J Offline
        J Offline
        jschell
        wrote on last edited by
        #3

        Besides JNI you can also do the following. 1. Wrap your C++ code in a executable 2. provide a communications interface (such as sockets) 3. Run/manage the the executable via Runtime.exec() and communicate with it via the communications api. The advantage to this over JNI is that it is easier to debug and the native code cannot crash the java VM.

        L 1 Reply Last reply
        0
        • J jschell

          Besides JNI you can also do the following. 1. Wrap your C++ code in a executable 2. provide a communications interface (such as sockets) 3. Run/manage the the executable via Runtime.exec() and communicate with it via the communications api. The advantage to this over JNI is that it is easier to debug and the native code cannot crash the java VM.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          I was involved in a commercial product that used this design model and it really was nothing but pain. In the end our management canned the whole thing because the outside company that did the bulk of the development could never get it to work properly.

          I must get a clever new signature for 2011.

          J 1 Reply Last reply
          0
          • L Lost User

            I was involved in a commercial product that used this design model and it really was nothing but pain. In the end our management canned the whole thing because the outside company that did the bulk of the development could never get it to work properly.

            I must get a clever new signature for 2011.

            J Offline
            J Offline
            jschell
            wrote on last edited by
            #5

            I worked with a senior developer that could not manage to produce a design document after three tries. On a very simple project. And before the third try I had basically outlined the document in detail to him.

            L 1 Reply Last reply
            0
            • J jschell

              I worked with a senior developer that could not manage to produce a design document after three tries. On a very simple project. And before the third try I had basically outlined the document in detail to him.

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Yes, there's no shortage of seniors like that in my experience. :sigh:

              I must get a clever new signature for 2011.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups