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!
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.
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!
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.
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.
Search on this forum for the classes involved in the problem. You have one and I mentioned one.
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!!