File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Problem in process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem in process" Watch "Problem in process" New topic
Author

Problem in process

syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 97
HI ,

I tried to access the command prompt and executing DOS commands using java .i successfully execute the command but when i tried to execute multiple DOS commands using command array its giving me error.



the error is


java.io.IOException: Cannot run program "cmd /c dir": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at com.java.language.ExploreRuntimeProcess.executeProcess(ExploreRuntimeProcess.java:15)
at com.java.language.ExploreRuntimeProcess.main(ExploreRuntimeProcess.java:25)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 5 more

please suggest me how to resolve this .

Thanks in advance


All search starts with beginner's luck and all search ends with victor's severly tested.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3647
    
  17

Hi Syruss,

Read the documentation for Runtime.exec() and take a good look at the array you're trying to pass to it.
syruss kumar
Ranch Hand

Joined: Jul 23, 2009
Posts: 97
Thanks a lot stephan

John Riool
Greenhorn

Joined: Sep 24, 2007
Posts: 5
Create your array with one command or option per element. Also note there should not be a trailing space in your elements.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in process