Results 1 to 5 of 5
  1. #1
    kala143 is offline Member
    Join Date
    Sep 2008
    Posts
    1
    Rep Power
    0

    Exclamation how to execute an executable using java

    hi all

    i want to execute an executable using java code ..
    that executable will read a pass phrase........
    how to execute an executable with out passing passphrase from the
    standard input or output using java or c program
    please help me
    thank u in advance

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,513
    Rep Power
    25

    Default

    To execute an executable from java use the Process and Runtime classes.
    How to pass data between the two???
    One way would be to could use Sockets.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Something like this you have to do.

    Java Code:
    Process p = Runtime.getRuntime().exec(path_to_executable_file);

  4. #4
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Something like this you have to do.

    Java Code:
    Process p = Runtime.getRuntime().exec(path_to_executable_file);
    of course you do that also with try and catch statement,cuz the excpetion can be thrown

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Definitely you must handle exception on each step. Not only in this case, each time when you deal with programming it must. A quality product can never clash because of an unhandle exception. Actually in Java it's not a big issue, but in low level languages like C++ you are dead.

Similar Threads

  1. convert a java binary/executable to a intermediate language
    By sumit_400461 in forum Advanced Java
    Replies: 1
    Last Post: 07-13-2008, 07:04 PM
  2. Execute a jar command from a java program
    By apremanandh in forum New To Java
    Replies: 3
    Last Post: 05-21-2008, 02:04 PM
  3. Executable Java
    By eva in forum New To Java
    Replies: 3
    Last Post: 12-30-2007, 11:38 PM
  4. Calling jar classes from java executable
    By SteM in forum Advanced Java
    Replies: 1
    Last Post: 11-27-2007, 08:21 AM
  5. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 05:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •