Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: How to write to an application

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to write to an application

    Hi,
    i have opened up using
    String[] commands = {"cmd", "/c", fileLocation};
     Runtime.getRuntime().exec(commands);

    and now i need to write a couple of lines to the application. Please help!
    Thanks in advance!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: How to write to an application

    Can you describe what you want your application to do?

    Are you trying to send data for "cmd" to read? See the choices for the I/O streams for the Process class. The names are sort of backwards. Input is what is input to the process, not input for you.
    If you do a search you'll find code samples.

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to write to an application

    yess thats what im tryind to do! open up a cmd window the write some texts to it to before a task.
    i tried searching google but i still dont really know what im looking for, it just comes up with running java files in command prompt.
    Last edited by straw; June 17th, 2010 at 06:13 PM.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,067
    Thanks
    47
    Thanked 2,146 Times in 2,119 Posts

    Default Re: How to write to an application

    Search on this forum for the classes involved in the problem. You have one and I mentioned one.

  5. #5
    Junior Member
    Join Date
    Mar 2010
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to write to an application

    right i figure it out i was doing it right all along!

    String[] commands = {"cmd", "any cmd command here", "you can do a series of commands", "eg cd C:/Users/Ollie/Documents"};
    Runtime.getRuntime().exec(commands);

    it's quite simple really!!

Similar Threads

  1. write object to sql db
    By wolfgar in forum JDBC & Databases
    Replies: 3
    Last Post: May 18th, 2010, 10:03 AM
  2. [SOLVED] [help] the application file (.jad) for application does not appear to be the ....
    By ordinarypeople in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: April 4th, 2010, 03:50 AM
  3. Replies: 0
    Last Post: December 3rd, 2009, 03:43 PM
  4. How can i write this in code?
    By Mr. steve in forum Java Theory & Questions
    Replies: 2
    Last Post: November 30th, 2009, 09:07 PM
  5. How to write above a JPanel
    By bruno88 in forum AWT / Java Swing
    Replies: 4
    Last Post: June 23rd, 2009, 06:16 PM