How to make a java program, that can be used by c++ application

I'm developing a Java web application (WEBapp), but I have also a c++ program.
C++ program must use WEBapp method to communicate on the web.
How to make a Java public function that accept value, elaborate, then return the resul to c++ application?

jschell wrote:
You have C code.
You have Java code.
The two must communicate.I have a c++ program, and a Java program.
C++ program wants to communicate on the web (send text), and I'm trying to add this functionality to it creating a Java program.
NOW THE PROBLEM? How c++ program can use java-program (in local) to send data on the web?
You can just JNI to communicate either from java to C++ or from C++ to java. That is direct communication in that there is a single process involved. Thus you will no longer have a java application and a C++ application but rather a single application.I don't know JNI, i found http://java.sun.com/docs/books/jni/ and I think is too difficult to implement?
You can use files or sockets to communicate. Using sockets allows for any number of additional protocols including the previously mentioned web services. Those methodologies would allow more than one application to exist.I developed yesterday a java-side-interface using socket (in local host 127.0.0.1). So the c++ program must write or read to/from the socket to comunicate to java (then the java program send data on the web).
Finally it might be the case that you have a C++ application which you cannot modify. In that case then you MUST use whatever input/output mechanism that it supports. There is no choice. And until you have fully determined what those mechanisms are it is pointless to discuss a solution.I can modify the application, but I don't have developed it. The c++ application use a third-part dll (taken from SKYPE) to comunicate on the web: I have to remove the dipendence from this dll, and add the java program: java program must substitute the dll. It must be non-invasive to the c++ program. DLL calls can be "send(data)" or "receive(data)" or similar.
For this do you think that JNI is a must, or I can use soket on local host?

Similar Messages

  • How to make a Java program that recognises a function of two variables...

    How to make a Java program that recognises a function of two variables to assign values to that?
    First I will give an example and then do the question.
    Ex1.
    We have any function, eg.y = x ^ 2 + 1 (read 'y' equals 'x' high to the square), a function of the second degree.
    To build the graph of this function attach values to 'x' to find the values of 'y'
    And thus mount the pair ordered (x, y) which represents a point on the Cartesian plane.
    Assigning values to 'x' 'we can build up a table that gives us the pairs ordered:
    We can use any numbers, but arfer interval [-3.3]
    X | y = x ^ 2 + 1
    -3 | Y = (-3) ^ 2 +1 = 10
    -2 | Y = (-2) ^ 2 +1 = 5
    -1 | Y = (-1) ^ 2 +1 = 2
    0 | y = (0) ^ 2 +1 = 1
    1 | y = (1) ^ 2 +1 = 2
    2 | y = (2) ^ 2 +1 = 5
    3 | y = (3) ^ 2 +1 = 10
    We then ordered the pairs:
    (-3.10), (-2.5); (-1.2), (0,1), (1,2), (2,5), (3,10)
    Tabem that can be represented by a table:
    X | y
    -3 | Y = 10
    -2 | Y = 5
    -1 | Y = 2
    0 | y = 1
    1 | y = 2
    2 | y = 5
    3 | y = 10
    Now I begin to explain my doubts.
    See this program:
    Ex2
    * To change this template, choose Tools | Templates
    * And open the template in the editor.
    Encontrando_o_valor_de_y package;
    * @ Author des Soldat Gottes
    Import javax.swing.JOptionPane;
    Public class (Main
    * @ Param args the command line arguments
    Public static void main (String [] args) (
    Int x, y;
    String x1;
    X1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',"); / / receives a value for the function y = x + 1
    X = Integer.parseInt (x1); / / tranforma String in int
    Y = x + 1; / / receives the value of 'x' and calculates' y '
    JOptionPane.showMessageDialog (null, "The value of 'y' is: \ t \ t" + y);
    / / Displays the value of 'y'
    System.exit (0);
    We see that the program receives above a value for 'x' and replaces the function contained in the program, y = x + 1, and so is the value of the variable 'y'.
    In: x1 = JOptionPane.showInputDialog ( "We have the function y = x + 1 \ n" +
    "Assign a value for 'x',");
    The entry is a number and that number is assigned aa ja existing function in the (y = x + 1).
    The question is: would it be possible to come to a function?
    Ex: the program ask: DIGITE THE FUNCTION?
    The USUARIO DIGITARIA A FUNCTION ANY, TYPE: y = x ^ 2 +1
    The program would recognize the function and give numerical values to that function as Ex1, at the beginning of this text.
    And then to find the values of the x and y launch a table.
    It would be possible that?
    By invez of entering with a number so that the program sustitua a function ja existing as Ex2, seen above, entering with a function quaquer (type: y = x ^ 2 +1) for the program atribuisse values to that function and then create a table of values as Ex1.
    I hope it has been easier to understand my doubts now.
    Thank you for your attention!
    God bless!

    rafaelmenezes wrote:
    Thanks for the explanation, could understand what fly said.
    But as it applied to a program?
    How to create a program that recognizes that the entry coefficients?Are you asking about how to parse out the coefficients from the string "3x^4 + 4x^3 - 8x^2 + 5x^1 + 2x^0"? If you define the format to strictly follow that example, this should get you started:
    Strip out the spaces
    Split the String on "x^"
    That should give you [3, 4+4, 3-8, 2+5, 1+2, 0]
    Split each resulting String on "+ | -", preserving the operator as a token so you can apply the correct sign to the coeff.
    That should leave you with [3, 4, +, 4, 3, -, 8, 2, +, 5, 1, +, 2, 0]. Every other number is a coeff, the rest are the degrees.
    You can strip out the +, since those coeffs are already positive, and strip out the - after negating the following number. This is all assuming that you have to write this yourself. There is no doubt already a library or 5 out there that does this for you.

  • How to make a java program that will give you the list of files in the dir

    How can you make a program in java that will list all the files in a directory with out useing the File,FileWriter,FileReader,InputStreamReader,FileInputStream,RandomAccessFile etc. classes

    What is with these instructors? So far today I have
    seen
    Do something 100 times, but don't use a loop
    Format numbers, but don't use NumberFormat
    and now this.
    What are these people trying to teach?
    Java??? I don't think so.Perhaps it is because these instructors are learning Java at the same time as their students. They are only one chapter ahead of the students. :(

  • I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing. Thanks, Tommy

    I want to write a java program that can add a user to a role or sub role to the Profile Database in iPlanet Portal Server 3.0. Does anyone has any idea or a sample program do such thing? Thanks, Tommy

    // create the user profile, get the handle back,
    // and set the membership profile attributes.
    ProfileAdmin newProfile = null;
    try {
    // the users profile name is the domain      
    // he belongs to plus their userName
    // you will request.domain if your doing this from a servlet, domain_name is the domain_name the user belongs too
    String profileName = domain_name + "/" + user;
         if (debug.messageEnabled()) {
    debug.message("creating profile for " + profileName);
    // create the user profile object
    newProfile = ProfileManager.createProfile(
    getSession(), profileName ,Profile.USER);
    UserProfile userProfile = (UserProfile)newProfile;
         // set the role the user is a member of. Default is to set
         // the users to the default role of the domain they surfed to
         StringBuffer roleName = new StringBuffer(64);
    // request.domain instead of domain_name if your doing this from a servlet ..
    Profile dp = getDomainProfile(domain_name);
    roleName.append(dp.getAttributeString("iwtAuth-defaultRole"));
         if (debug.messageEnabled()) {
    debug.message("setting role for " + user + " = " + roleName);
    userProfile.setRole(roleName.toString());
    newProfile.store(false);
    } catch (ProfileException pe) {
         debug.error("profile exception occured: ",pe);
    return;
    } catch (ProfileException pe) {
         debug.error("login exception occured: ",le);
    return;
    HTH ..

  • I would like to make a poker program that can be played over the internet

    I would like to create a java poker program that can be plyed over the internet. I would post the code on a website and everyone that goes should be able to play. Someone told me to use a socket but i dont no how. Also i dont know how to make a program that many people can use at once. PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!! So i want to make a holdem poker program in black and white that like 6 people can play by going to a web site. Thanks

    I would like to create a java poker program that can
    be plyed over the internet. I would post the code on
    a website and everyone that goes should be able to
    play. Someone told me to use a socket but i dont no
    how. Also i dont know how to make a program that
    many people can use at once. PLEASE HELP
    ME!!!!!!!!!!!!!!!!!!!!!!!!! So i want to make a
    holdem poker program in black and white that like 6
    people can play by going to a web site. ThanksIf you want to use a socket, you're on the wrong board. What does your webhoster support? J2EE? Root access so you can install your own server?

  • How to make a java-program to a exe file runing on windows?

    i kown that there were many topics on this problem.
    i want to kown how many kinds method to do this i can use now!
    i met a java-program can run on windows,but i don't find ant *.class
    files and *.jar files.it's extended file type is ".ese".
    thanks very much

    There are commercial products that allow you to do this (e.g. InstallAnywhere from http://www.zerog.com).
    One issue is that you have to decide whether you want to bundle a JRE with your program or not. If you do (and you should, in these days of XP shipping without any VM of its own), your program will be a minimum of about 9MB + whatever you actually add as part of your program :-).
    In any case, this is not a trivial undertaking.

  • How to make a java program run as a background process.

    </pre>
    writing a client server application.
    a program is supposed to run on a the client right from the time the client turns on the computer till the computer is turned off.
    the catch is the client should all the time be unaware of the program running in his computer, no dos prompt window, no icon on the taskbar,etc. can i convert it the class file into an exe file through software and put the exe filename in autoexec.bat. But then i think that the dosprompt window will open up on starting, but the client should see nothing.
    please help
    </pre>

    </pre>
    Thanks Daniel and jesper,
    could not really fully understand what you mean.
    creating a batch file is okay, but do you configure it
    to run in a an hidden mode.
    Also I have no idea of how to make a window
    service.can you please elaborate a bit
    </pre>

  • How to create an OS command that can be used in the process chains

    I need to create a command that can copy files from one location to another for a unix machine.
    I have the commands for the unix machine, but need to create a Z customer command so it can be executed in a process chain in SAP

    Hi Again,
    You can use ABAP program in the process chain.
    I guess there are some OS level commands in ABAP which will allow you to open, close, read , write and move files.
    Serach in ABAP help or on net.
    Bes regards,
    Sunmit.

  • How to make a tool tip that can be selected

    i am making an online system that reads contacts from the addressbook of a user in his database. i want that every time the user enters a key on the input field in html, a script searches for a matching contact in the database and displays it in a tooltip that could be selected so that the user will not type any further and just select on the matching contacts. how do i do this? tnx

    Well, that does not have much to do with Graphics, which might explain why no answers were given so far...
    Basically, you need to look into AJAX. Set the onClick event handlers of the field to send an asynchronous request to the server, parse the response and put it into an initially invisible div, that is placed just under that text field.
    Have a look at prototype.js, here:
    http://prototypejs.org/
    Hope that helps.
    Michael Bar-Sinai
    Edited by: mich.barsinai on Oct 23, 2007 12:58 PM

  • How do I create DRM Licenses that can be used for Offline Playback?

    [ Background ]
    Typically, a license is acquired from the DRM license server when the client video player encounters a video that is DRM-protected.   However, some use cases call for the ability for end-users to be able to play DRM content when a network connection is not available to the device.
    For example - the user wants to download a video from their home, acquire a license to play the content, and then get onto a train/airplane where a network connection isn't available.  On the train/airplane/etc..., the end user expects to be able to watch their video that they downloaded at home.
    [ DRM Policy Requirements ]
    For this use case to be possible, the DRM license must be acquired when the network connection is available.  In addition, the DRM license must be allowed to persist on the device disk.  For this to be possible, one value must be present in the DRM policy:
    1. Offline License Caching must be set to 1 or higher.  This policy parameter indicates how many minutes a license is allowed to be persisted to disk once it's been acquired by the license server.
    [ Workflow ]
    Now that the content has been packaged with a DRM policy that allows for offline caching (persistance) of a license, the video player simply has to acquire the license before the network connection is lost.  This can be accomplished via the typical API calls that the Video Player Application Developer would use to do a normal DRM license acquisition (DRMManager.loadVoucher()).
    For example, by using the DRMManager ActionScript3 API: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/drm/DRMManage r.html
    For other platforms supported by Adobe Access DRM (iOS, Android, etc...), please refer to the appropriate documentation around playback of DRM content on how to pre-fetch the DRM license.
    [ Workflow - iOS ]
    Enabling offline playback using the Primetime Media Player SDK (PSDK) for iOS requires a bit of self-extraction & instantiation of the DRM Metadata from the m3u8.  The reason for this is that as of PSDK v1.2, the PSDK APIs do not expose an mechanism for extracting the DRM metadata.
    You must manually (outside of the PSDK) get access to the DRM Metadata, instantiate a DRMContentData, and then use the DRMManager class to obtain a license for your content.  Afterwards, you may download your HLS content and stream it to your video player application locally.  Since the DRM license was pre-acquired before playback of the downloaded HLS content, your video player application does not require a network connection to acquire a DRM license.  Below is a code sample of obtaining the DRM Metadata from the m3u8 manifest and then using it with the DRMManager singleton.
    /*          Main entry points, playlistURL is url to a top level m3u8. */
    void PlayContent(NSURL* playlistURL)
              DRMManager* drmManager = [DRMManager sharedManager];
              if ([drmManager isSupportedPlaylist:playlistURL])
      // First we need a handler for any errors that may occur
                        DRMOperationError errorHandler = ^(NSUInteger major, NSUInteger minor, NSError* nsErr)
      /*          report error. */
      /*          Synchronous call to DRM manager to extract DRM metadata out of the playlist. */
                        [_drmManager getUpdatedPlaylist:playlistURL
                                                                                      error:errorHandler
                                                                                    updated:^(NSURL *newPlaylist, DRMMetadata *newMetadata)
                                   (void) newPlaylist; /*          updated URL is not used for this code sample. */
                                   if (newMetadata)
                                                      Assumes we are going to try to satisfy requirements to acquire license on the first policy in the metadata.
                                                      If there are multiple policies in the metadata, only 1 of them need to be satisfied for the license request to
                                                      go through.                                          
                                             DRMPolicy* drmPolicy = NULL;
                                             for (id object in newMetadata.policies) {
                                                       DRMPolicy* drmPolicy = (DRMPolicy*)object;
                                                       break;
                                             if (drmPolicy == NULL)
                                                       /*          report error, this metadata is malformed. DRM metadata must contain at least 1 policy*/
                                             if (drmPolicy.authenticationMethod != ANONYMOUS)
    However, please note that the above only describes the DRM license handling for offline playback.  The actual playback of video using the Primetime client SDK is not officially supported.  You will have to use your own mechanism of saving and playback back HLS content locally within the application.
    Theoretically, it is possible to save the HLS stream to the app, and then embed an HTTP server to the app to stream the HLS content back into the application.  However, the Primetime client SDK doesn't not expose a way to do this directly, since it's not yet supported.
    cheers,
    /Eric.

    no, the headers, here's a picture of the headers on this page. When I use SEO for Firefox, it sees them on every other page but never on my iweb sites.
    Quickpost this image to Myspace, Digg, Facebook, and others!

  • How do i format an invite that can be used in outlook

    Invites sent to outlook users can not be accepted or added to their outlook calendar. Anyone have a suggestion for way to resolve issue?

    Webform with HTML would be best.
    But depends on a lot of things...
    InDesign is not a web authoring program.
    But it can produce fillable forms ... which are PDF.
    So if you want it on your site - a webform is best.
    If you want it as link they fill out and submit then InDesign.

  • Java program that create a graphic interface of the WGET program

    Hello,
    How can I make a Java program that create a graphic interface of the WGET program.
    Please post something already developed.
    No Applet.
    Thank you.

    You can use java.lang.Runtime.exec or java.lang.ProcessBuilder to execute external programs like wget. Generally you pass one of those methods an array of Strings; the first String is the name of the executable, and the rest are arguments. You get a Process object that represents the running process that you've started; you can get standard input and output streams from that Process to read output. This is probably stuff your teacher already told you...but if not, hope it helps.
    You should read this article about pitfalls around Runtime.exec:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Much of the information there also applies to ProcessBuilder.
    Good luck on your homework.

  • Hi! I have a Creative suite Design Standard 9 Adobe program and I am attempting to make a wizzard form that can be made into an entry form for a competition. So I need to 1. Make the form into a question and answer form that Participants may fill out. 2.

    Hi! I have a Creative suite Design Standard 9 Adobe program and I am attempting to make a wizzard form that can be made into an entry form for a competition. So I need to 1. Make the form into a question and answer form that Participants may fill out. 2. make it possible for them to download it via a link on our website 3. make it possible for them to save the info they have written into the form and mail it to the mail we have supplied in the entry form and 4. make it possible for them to put in a jpg. as part of the entry for and lastly 5. make it possible for us to copy paste the document and use it on other platforms. How do I do this - is it at all possible with adobe?

    Those requirements are go way beyond what PDF forms can do and are meant for, some of them would require involving other programs or are mutually exclusive and contradictory. You are wasting your time even thinking about doing this as an "offline" PDF form. Simply sign up for an online forms/ survey service like FormsCentral or Surveymonkey.
    Mylenium

  • How to make a Java application that will change the client box's IP address

    HI how to make a Java application( that application would be run on the client ) that will change the client box's IP address ( IP address of itself )

    If you can do that through the command line, then use Runtime.getRuntime().exec(...) to execute your command.

  • Im making a photo slide show using imovie. how will i make a dvd copy that can play in both pc and dvd player.  i dont have an idvd anymore. m using a mbp early 2011 osx 10.8.5

    im making a photo slide show using imovie. how will i make a dvd copy that can play in both pc and dvd player.  i dont have an idvd anymore. m using a mbp early 2011 osx 10.8.5.
    after making the photo slide show, i clicked share>export movie.  after which i burned using toast. the file became a .mov.  i tried playing it in my mac and it worked. my fear now is will it also play in a regular dvd?... i read from google that mov files won't run in dvd players.  what format should i convert it to so it'll play in a dvd player.  can you suggest a faster way i can burn my projects for it takes me almost an hour to export.  im going to make 28 slideshows for my kids in school. *=( if i need to do this process 28 times, i may not be able to finish it on time.  please suggest a software or an alternative as to how i should do this... m more comfortable using imovie than iphoto.  thanks and i hope to hear from someone soon *=j

    Thank you QuickTimeKirk...used toast to burn project... my project was in .mov, i tried to play it a dvd player, it did play... will try again tomorrow using another dvd player just to be sure it'll will really work with dvd players.  thank you again for your reply *=)

Maybe you are looking for