Results 1 to 2 of 2
  1. #1
    danielleon11 is offline Member
    Join Date
    Jul 2010
    Rep Power

    Smile execute a .exe with attributes from java

    Hello, to transfer a CSV file from a Mysql Server to a client I run the following command in cmd:

    C:\path_where_mysql_is\mysql --user=root --host=localhost --password=mypass --database=mydb --execute="select * from table;" > C:\some_output_file.txt

    How can I run this command from java.... I read that Runtime.getRuntime().exec() can help me but I really don't know.. Thanks

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    Have a look at the new ProcessBuilder here

    Where you can set up an array of the command line parameters and pass it into the exec(String[] cmdarray).

    Perhaps use a List<String> to build up the parameters too then call toArray when passing it into ProcessBuilder.exec().

Similar Threads

  1. time to execute a java app
    By svpranay in forum New To Java
    Replies: 6
    Last Post: 06-23-2010, 09:06 AM
  2. Replies: 9
    Last Post: 11-19-2009, 05:31 PM
  3. how to execute an executable using java
    By kala143 in forum Java 2D
    Replies: 4
    Last Post: 09-26-2008, 04:10 PM
  4. Replies: 2
    Last Post: 12-04-2007, 11:49 AM
  5. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 06:42 AM

Tags for this Thread

Posting Permissions

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