Help. about java c++ interaction

there is a java program in the unix environment, it will run a tool software written in c++.the c++ program will send back some options by stdoutput,the java program gets it and makes the choice,and then send to c++.this procedure will repeat several times until there comes the result from the c++ program.
i want to know what kind of solution should i choose in java language.
i tried
process p = runtime.getRuntime("command");
but can read and write only once,which is not interaction indeed, and then the program hangs.if you think it is the solution,could you give me some examples programs about that.

First let me say what i understand of ur problem,
u essesntially want to invoke some c++ code(a method) and then want the method to return back some value. right?
using exec() method won't solve ur problem, as it starts the process in another address space and u won't be able to establish communication as such.
the way which i used to take care of similar problem is to use JNI.
Using JNI, i invoked the C++ method. there is something called JNIEnv thru which i can access the variables of java from within the c++ method this enabled me to obtain results from the c++. u can also get the value the method returns. The method gets invoked just like any other java class method. This shuld solve ur problem i guess
and it is also not that complicated and i guess i can help u with this
regards
Deepak Saini

Similar Messages

  • Need help about java

    guys i need ur help.
    i have just started to learn java. but not getting the basics of it. can u plz suggest any book for it ? so that i can start studying it. how should i proceed? plz provide me the necessary information about it.

    I'd suggest forgetting about Java until you have
    learnt English.
    ur, u, plz are not words.That's indeed a valuable input. I'm fearing the day
    when I see someone writing code like
    pblc sttic vod mn(Strng[] a) {
    Sstm.out.prntln("Hw r u!");
    ode]and complain about "Jav bad, Jav not run".
    followed by someone launching a JSR "SMS 1ee7 sp3ak syntax for Jav" which gets immediately approved.

  • URGENT HELP about java.util.zip.ZipException: invalid entry CRC

    I have a program (JAVA of course) packet on JAR with fat-jar eclipse plugin. This program work well in all my computers except two. On these two computers I receive a java.util.zip.ZipException: invalid entry CRC.
    Both computers have the last version of java, but one is Windows and the other is Linux.
    Any help to find the source of this problem??
    Thanks in advance.

    Sorry, I give poor information about this problem.
    This is the full error showed when I execute this command: java -jar app.jar
    Unable to load resource: java.util.zip.ZipException: invalid entry CRC (expected 0x358054d7 but got 0x7dc370ba)
    java.util.zip.ZipException: invalid entry CRC (expected 0x358054d7 but got 0x7dc370ba)
    at java.util.zip.ZipInputStream.read(Unknown Source)
    at java.util.jar.JarInputStream.read(Unknown Source)
    at java.io.FilterInputStream.read(Unknown Source)
    at com.simontuffs.onejar.JarClassLoader.copy(JarClassLoader.java:818)
    at com.simontuffs.onejar.JarClassLoader.loadBytes(JarClassLoader.java:383)
    at com.simontuffs.onejar.JarClassLoader.loadByteCode(JarClassLoader.java:371)
    at com.simontuffs.onejar.JarClassLoader.loadByteCode(JarClassLoader.java:362)
    at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:305)
    at com.simontuffs.onejar.JarClassLoader.load(JarClassLoader.java:224)
    at com.simontuffs.onejar.Boot.run(Boot.java:224)
    at com.simontuffs.onejar.Boot.main(Boot.java:89)
    Exception in thread "main" java.lang.ClassNotFoundException: com.intarex.wizard.IWizard
    at com.simontuffs.onejar.JarClassLoader.findClass(JarClassLoader.java:497)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at com.simontuffs.onejar.Boot.run(Boot.java:240)
    at com.simontuffs.onejar.Boot.main(Boot.java:89)
    app.jar is a JAR file created with fat-jar eclipse plugin, to make easier to generate a JAR file with all dependencies.
    I think that is not a code related problem, because this program is executed in several computers without errors.
    I trasport this JAR to the client computer via HTTP.
    I'm trying to find clues to find the origin of this problem.
    Thanks.

  • Help about Java web service

    hi
    does anyone help me on java web service.
    what I want is: does the java interact with C# web service? because I have some of project in C# and some of it in java. and another thing: can any one direct me to some lessons for java web sarvice?
    thanks

    Hello,
    You can have a lootk at the Tango project.
    http://java.sun.com/developer/technicalArticles/glassfish/ProjectTango/
    Regards,
    Sebastien Degardin

  • Plz help about JAVA

    I am trying to print coupons from red plum and other manufactures site's i have installed java 50 + time's also have tested java and it says it is working just fine. i close all tabs as it says to do reopen page i was trying to print from and still i keep getting
    Want to Print Coupons?
    Using the latest version allows for secure printing of coupons. Java is 100% safe! Read our FAQ for more information and click the Java icon below to install:
    OK i do this over and over again how do i fix this to get java to print for me. I have also e-mailed all manufactures and they keep saying it's not us it's this site ECT if you can help it would be nice thank you in advance.
    Edited by: 979401 on Jan 1, 2013 5:50 PM
    Edited by: 979401 on Jan 1, 2013 6:16 PM

    As I told a friend of yours with the very same question yesterday:
    there's a white text field to the left. Type "USB" there. Hit Enter or click the ">>" button.

  • Help.about "java -jar"

    execute "java -cp second.jar;main.jar main.Main", it is ok.
    but
    execut "java -jar -cp second.jar main.jar", it fails. It report that java can't find one class in second.jar. The second.jar is not any changed.

    if you use the -jar arg, then java needs to know which Main-class to run in the jar. You have to state this explicitly in the file 'Manifest.mf' which should be in your jar-file in the folder 'meta-inf'. In that file state the location of the main-class like this:
    Main-Class: package1.package2.MyMainClassName
    greetz,
    Stijn

  • I keep getting an error window about java since I updated to firefox 8, my tabs will flash, tabs will close and open in a new window, everything stops working, firefox is non responsive, please help

    Since I upgraded to firefox 8, I get this error window that pops up says something about java. My tabs flicker or flash, the tabs will close and open in a new window then everything stops. Then firefox does not respond. When I get this error message, I have to close all tabs wait a few seconds then open it back up it will work for a little while and then do the same thing. I have disabled plug-ins that I do not use, I have cleared my cache and cookies, I am not happy at all with this new version. I waited a while before updating. The first time I was going to update, firefox would not let me keep my anti-virus plug-in. PLEASE HELP

    Hello,
    The Reset Firefox feature can fix many issues by restoring Firefox to its factory default state while saving your essential information.
    Note: ''This will cause you to lose any Extensions, Open websites, and some Preferences.''
    To Reset Firefox do the following:
    #Go to Firefox > Help > Troubleshooting Information.
    #Click the "Reset Firefox" button.
    #Firefox will close and reset. After Firefox is done, it will show a window with the information that is imported. Click Finish.
    #Firefox will open with all factory defaults applied.
    Further information can be found in the [[Reset Firefox – easily fix most problems]] article.
    Did this fix your problems? Please report back to us!
    Thank you.

  • I can't open ibooks. There was a screen pop up about java se. Help please.

    I can't open ibooks. There was a screen pop up about java se. Help please.

    Hi there ajsupprt,
    It sounds like you may need to update the version of Java installed on your computer. Take a look at the article below for more information.
    Java updates available for OS X on August 28, 2013
    http://support.apple.com/kb/ht5648
    -Griff W.

  • About Java 2 opaque font color question, help needed!

    About Java 2 opaque font color question, help needed!
    I was trying to test opaque font (the string has a foreground color and a background color), but i can't find the method for doing that.
    i can change foreground by Graphics2D.setPaint(Color.black).
    Anybody know how to change the background of the string?
    Thanks!

    Hi. The way I'd do it would be to use the font metrics to find the length of a string and draw a rectangle and then drawstring over the rectangle. If you want an example, I can post it although I suspect theres a better way.

  • Beginner in java and need your help about DES

    hello,
    I m a new guy in java programming and learn from many books.I m making a website and portal right now and dying need your help about DES.my portal (using java) requires somebody to make a login name and a password.I m done with the server and client things and rite now stuck with this "DES" stuff.
    so I make some conditions and algorithm below..
    1. when a user login,the password is encrypted.at this point,cleartext(id) and encryption (M,N) are involve.
    2. then the key is changed based on algorithm.
    3.the key changed by key(id) is received and the original text should be encrypted.
    the algorithm
    1. the original text x1.x2.x3.x4.x5.x6.x7.x8 (64 bits)
    2. encypt the password
    a. Each character is changed into an int type by the ASCII code, and let the 1st bit be an odd number parity bit.
    b.The 1st bit of the 1st character in (IP) is set to '1', and the 8th bit of the 8th character as '64'.
    c.the rest (IP) is like this
    1 2 3 4 5 6 7 8
    0 # 58 50 42 34 26 18 10 2
    8 # 60 52 44 36 28 20 12 4
    16 # 62 54 46 38 30 22 14 6
    24 # 64 46 48 40 32 24 16 8
    32 # 57 49 41 33 25 17 9 1
    40 # 59 51 43 35 27 19 11 3
    48 # 61 53 45 37 29 21 13 5
    56 # 63 55 47 39 31 23 15 7
    d. and lastly,from above,,it should be done like this
    1 2 3 4 5 6 7
    0 # 40 8 48 16 56 24 64 32
    8 # 39 7 27 15 55 23 53 31
    16 # 38 6 26 14 54 22 52 30
    24 # 37 5 25 13 53 21 51 29
    32 # 36 4 24 12 52 20 50 28
    40 # 35 3 23 11 51 19 49 27
    48 # 34 2 21 10 50 18 48 26
    56 # 33 1 20 9 49 17 47 25
    e. key y1,y2,y3,y4,y5,y6,y7,y8 (64bit)
    f. generate the key based on ID
    a. Each character is changed into an int type by the ASCII code, and let the 1st bit be an even number parity bit.
    b.the process is repeat again.
    anybody has an idea to help me with the sample program?
    thanks in advance...

    just ask about a simple program how to receive a
    password from somebody and change it to a key..and
    then confirm it with DES.Once again I have a problem understanding what you are asking.
    Are you trying to use the password as a key to encrypt some 'standard thing' and place this encrypted value in a database? If so then look in the JCE for 'password based encryption' such as PBEWithMD5AndDes. This seems back to front to me but I can see nothing wrong with the approach since the 'standard thing' you would encrypt is in effect a key. If this is for a commercial application then I would find a security expert to evaluate your proposal!
    In my experience it is more normal to encrypt the user's password with DES and store the result in the database. To do this just look in the JCE for DES encryption and consider using DES with CBC and PKCS5 padding. Also, consider encrypting the concatenation of the user's 'user name' with the password as this will (almost certainly) avoid having two encrypted values in the database that are the same even if two users have the same password.
    For both of these you might consider using Base64 or Hex to turn you encrpted bytes into ASCII characters before trying to store them in your DB.

  • NO clue about JAVA but need help please

    I am cleaning up someone's else work who used to be employed here. I know ZIP about Java but am becoming more and more familiar with WAR files and deplying them with Jrun on an NT2K Server.So here is what I have. I have a deployed app from months ago. I have a new app to deploy. I did this successfully. I can access it, etc. But I am getting some SQL error.
    Can anyone give me any idea what it could be? I have looked at my sqlcustomauthentication.java file and i have not anything to it. Why would something change on this when all I really did was re-deploy it.
    Here is the error.
    Thanks a TON!!
    java.lang.NullPointerException:
         at allaire.jrun.security.SQLCustomAuthentication.getName(SQLCustomAuthentication.java:76)
         at jrun__members2ejspc._jspService(jrun__members2ejspc.java:62)
         at allaire.jrun.jsp.HttpJSPServlet.service(HttpJSPServlet.java:39)
         at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:228)
         at allaire.jrun.jsp.JSPServlet.service(JSPServlet.java:196)
         at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
         at allaire.jrun.session.JRunSessionService.service(JRunSessionService.java, Compiled Code)
         at allaire.jrun.servlet.JRunSE.runServlet(JRunSE.java, Compiled Code)
         at allaire.jrun.servlet.JRunRequestDispatcher.forward(JRunRequestDispatcher.java, Compiled Code)
         at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
         at allaire.jrun.servlet.JRunSE.service(JRunSE.java, Compiled Code)
         at allaire.jrun.servlet.JvmContext.dispatch(JvmContext.java, Compiled Code)
         at allaire.jrun.jrpp.ProxyEndpoint.run(ProxyEndpoint.java, Compiled Code)
         at allaire.jrun.ThreadPool.run(ThreadPool.java, Compiled Code)
         at allaire.jrun.WorkerThread.run(WorkerThread.java, Compiled Code)

    It looks like maybe you are having a problem in the way you are accessing the authentication on your db. From the error message, I would say the name field needed to log in is never being set

  • Sreaming at the top of my lungs for HELP with Java Script problem!

    Hello,
    I have this strange problem that no one seems to know why or how to fix it.Whenever I encounter a web site that has java scripting for anything pop ups or redirects to url's anything that says java script when I mouse over the link my browsers do nothing.That is for explorer 6.0 beta netscape 4.7 and netscape version 6.I have tried in another forum some suggestions but nothing changed even though I am told nothing is wrong with the java scripting.I used to be able to click java script's with all of these browsers but no longer.That was a few months ago.Now to try something new I tried to see if a new browser would work.I now have the latest version of Opera.It did work but using Opera on some sites limits what I can do so it doesn't solve my problem.Then I tried the Sun JavaHot browser it also worked but limits what I can do on some site's.I have Windows 98 & updated most of my dll's etc & my java is version 2 1.3.1.My java script is enabled in Explorer & netscape's & the security is at a minimum level.Please help me figure out why these other browsers work but the other's do not.I want to edit a web site of mine but I can't because of this problem.I am very frustrated by this and need as detailed help as I can get.Anything of a suggestion would be very much appreciated.But I am also not an expert on the working's of a computer so bear with me.
    Brian

    Hi,
    Well I am thinking that if anyone could know something about Java script it would be java developers.But anyways I had the previous version of explorer 5.0 & the java didn't work in it either.Now how weird is this,I opened netscape 4.7 today & the java scripts are suddenly working.This has me scratching my head wondering if my computer is possesed by some force beyond my capability to know...????Weird as it seems though the explorer still will not respond to a java script.
    Brian

  • Not able to view Forms Server version in Help: About Oracle Applications after the forms upgrade 10.1.2.3.0

    Hi all,
    DB:11.2.0.3.0
    EBS:12.1.3
    O/S: Sun Solaris SPARC 64 bits
    I am not able to view Forms Server version in Help: About Oracle Applications after the forms upgrade 10.1.2.3.0 after the forms upgrade 10.1.2.3.0 as per note:Upgrading OracleAS 10g Forms and Reports to 10.1.2.3 (437878.1)
    Java/jre upgraded to 1.7.0.45 and JAR files regenerated(without force option). Able to opne forms without any issues.
    A)
    $ORACLE_HOME/bin/frmcmp help=y
    FRM-91500: Unable to start/complete the build.
    B)
    $ORACLE_HOME/bin/rwrun ?|grep Release
    Report Builder: Release 10.1.2.3.0 - Production on Thu Nov
    28 14:20:45 2013
    Is this an issue? Could anyone please share the fix if faced the similar issue earlier.
    Thank You for your time
    Regards,

    Hi Hussein,
    You mean reboot the solaris server and then start database and applications services. We have two databases running on this solaris server.
    DBWR Trace file shows:
    Read of datafile '+ASMDG002/test1/datafile/system.823.828585081' (fno 1) header failed with ORA-01206
    Rereading datafile 1 header failed with ORA-01206
    V10 STYLE FILE HEADER:
            Compatibility Vsn = 186646528=0xb200000
            Db ID=0=0x0, Db Name='TEST1'
            Activation ID=0=0x0
            Control Seq=31739=0x7bfb, File size=230400=0x38400
            File Number=1, Blksiz=8192, File Type=3 DATA
    Tablespace #0 - SYSTEM  rel_fn:1
    Creation   at   scn: 0x0000.00000004 04/27/2000 23:14:44
    Backup taken at scn: 0x0001.db8e5a1a 04/17/2010 04:16:14 thread:1
    reset logs count:0x316351ab scn: 0x0938.0b32c3b1
    prev reset logs count:0x31279a4c scn: 0x0938.08469022
    recovered at 11/28/2013 19:43:22
    status:0x2004 root dba:0x00c38235 chkpt cnt: 364108 ctl cnt:364107
    begin-hot-backup file size: 230400
    Checkpointed at scn:  0x0938.0cb9fe5a 11/28/2013 15:04:52
    thread:1 rba:(0x132.49a43.10)
    enabled  threads:  01000000 00000000 00000000 00000000 00000000 00000000
    Hot Backup end marker scn: 0x0000.00000000
    aux_file is NOT DEFINED
    Plugged readony: NO
    Plugin scnscn: 0x0000.00000000
    Plugin resetlogs scn/timescn: 0x0000.00000000 01/01/1988
    00:00:00
    Foreign creation scn/timescn: 0x0000.00000000 01/01/1988
    00:00:00
    Foreign checkpoint scn/timescn: 0x0000.00000000 01/01/1988
    00:00:00
    Online move state: 0
    DDE rules only execution for: ORA 1110
    ----- START Event Driven Actions Dump ----
    ---- END Event Driven Actions Dump ----
    ----- START DDE Actions Dump -----
    Executing SYNC actions
    ----- START DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (Async) -----
    Successfully dispatched
    ----- END DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK'
    (SUCCESS, 0 csec) -----
    Executing ASYNC actions
    ----- END DDE Actions Dump (total 0 csec) -----
    ORA-01186: file 1 failed verification tests
    ORA-01122: database file 1 failed verification check
    ORA-01110: data file 1:
    '+ASMDG002/test1/datafile/system.823.828585081'
    ORA-01206: file is not part of this database - wrong
    database id
    Thanks,

  • Give me description about JAVA Proxy Runtime and JAVA Proxy Server

    Give me description about JAVA Proxy Runtime and JAVA Proxy Server with some examples.

    Hi,
    Java proxy runtime :
    Using the Java proxy runtime you can receive messages or send messages to the Integration Server.
    This will help you
    http://help.sap.com/saphelp_nw04/helpdata/en/64/7e5e3c754e476ee10000000a11405a/frameset.htm
    Java proxy server :
    The connection to the Integration Server by using the Java proxy runtime.
    This will help you
    http://help.sap.com/saphelp_nw04/helpdata/en/87/5305adc23540b8ac7bce08dbe96bd5/frameset.htm
    Regards
    Agasthuri Doss

  • Questions about Java Servlets and JSP

    Hi,
    I'm a confident Java Programmer (and really enjoy using this language) but am very new to Java servlets and Java Server Pages.
    I have previously worked with Perl on my web projects (simple 'league' style voting pages). I read in my 'Core Java' book that I should no longer use perl or even cgi.
    I need to know more about Java servlets and Java Server Pages so I can make the switch to a 'real' programming language.
    I have a few questions:
    How should I start to learn JS and JSP?
    How applicable will the java knowlegdge I have already be?
    Are JSP common on the world wide web?
    What tools do I need to start? (I currently develop in JBuilder and have Java 1.4.1 Standard Edition)
    Is it likey my web host (and others) will support JSP?
    Thank-you very much for helping a novice get started,
    Regards,
    Paul

    Hi, Steve ...has to be frustrating! But do not despair.
    Let's suppose the servlet it's named MyServlet on package org.servlets
    WEB-INF should look:
    WEB-INF
    classes
    org
    servlets
    MyServlet.class
    web.xml
    web.xml file should have this two declarations:
    <web-app>
      <servlet>
        <servlet-name>MyServlet</servlet-name>
        <servlet-class>org.servlets.MyServlet</servlet-class>
      </servlet>
      <!-- other servlets -->
      <servlet-mapping>
        <servlet-name>MyServlet</servlet-name>
        <url-pattern>/MyServlet</url-pattern>
      </servlet-mapping>
      <!-- other servlets mappings -->
    </web-app>Now, once the container starts (Tomcat?), you should be able to see that servlet in:
    http://localhost:8080/[my-context/]MyServletAnd what my-context is? The web application context. This string should be empty if your're deploying to the root context, otherwise should the context name. In Tomcat, deploying to root context defaults to using webapps/ROOT.
    Sorry for my English, but I felt the need to answer your request. I hope it helps despite my writing.

Maybe you are looking for

  • Including text to contract and copy in PO

    Hi,      I have created a text with a text name(PO_TEXT) in SO10 transaction. When creating contract(ME31k), in release order text, i have included the text that i have created.But it is not displaying the text that i have created. It is just saying

  • Store Filename on a table in PI server.

    Hey Guys I have a requirement in which i need to store all the filenames on a table in PI server and then run a ABAP report by the end of the day(every 24 hours) to display list of all the files which passed through PI. The solution i m thinking of r

  • Errors in binary data

    Hi I am getting some errors in the binary data I am reading over a serial link using the vi attached. The vi removes the first seven characters (which are not part of the data string) then converts the binary data to an array of unsigned 16 bit integ

  • Can each of our users play their own game?

    My boys each have an iPad, but only one can open a game at a time and when the other opens the game, they have to share the same place and stats. Do I need different Game Center accounts? Or different Apple IDs? Any suggestions? These games include C

  • Having trouble downloading software for my newer phone.

    I have just purchased a second Blackberry Curve 8310.  I am trying to get my information from my original one onto the new one.  However, when I plug in my newer one, Windows says New Hardware Found, and then will not let me install it.  I have tried