How to run external softwares from within java code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • joydeepdg
    New Member
    • Apr 2010
    • 9

    How to run external softwares from within java code?

    I want to know how can I execute external softwares from within my java code.Actually what my java code does is that it takes a voice input from user and converts it into a .wav file.Then it has to execute a external software that that takes two wav files and returns the percentage similiarity between them.
    The part upto saving the user voice input as a .wav file is done.Now I need to know how can i get my code to :

    (i) Start and run the software.
    (ii)Make the two wav files available to the software for its execution.
    (iii)Take the result (percentage similiarity) from the software and print it on the screen or save it in variable.

    For me this is really complex so awaiting responese from all of you.

    Thanks in advance.
  • Fr33dan
    New Member
    • Oct 2008
    • 57

    #2
    If the other program is a command line program you can use the Runtime Class to create a Process object to run the program. Then fetch the results from process's the InputStream after it's been run.

    Comment

    • joydeepdg
      New Member
      • Apr 2010
      • 9

      #3
      Actually its not a command line program but a software downloaded from net.It has a specific GUI which takes two wav files and displays the percentage similiartiy between them.So how do I make this software run properly from within my java code?? please Help.

      Comment

      • Fr33dan
        New Member
        • Oct 2008
        • 57

        #4
        Unfortunately that makes the task exponentially more difficult and I wouldn't know how to begin to do that. To be honest I'm not sure if that is possible for the Java interpreter to have that much control of the system but maybe someone else has some ideas?

        Comment

        • jkmyoung
          Recognized Expert Top Contributor
          • Mar 2006
          • 2057

          #5
          If the other program doesn't have an API to use with it, you're getting into the realm of automated testing/programming, which is much more complex. You have to really ask yourself at this point: is it worth programming this part of the program in?

          If you still think it is, look up MouseClick events and the Robot class.
          1. You have to ensure you can resize/move the program to the correct spot. I suggest forcing a maximize of the program.
          2. The interface of the program can not change significantly; and very small things are now significant.
          3. Save your .wav files to a set location on the computer every time, and have the other program load it from that same location, saving the results to a similar permanent result location.

          Comment

          Working...