Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ProcessBuilder: Cannot run program

user12076936Aug 22 2009 — edited Aug 23 2009
Hello,

In my code I need to run a windows application. Through the Command Prompt I would type:
C:\>"C:\Documents and Settings\Simpatico\My Documents\Woerter Speichern Files\changeBackgroud" "C:\\Documents and Settings\\Simpatico\\My Documents\\Woerter Speichern Files\\testimage.bmp"
In Java I wrote:
ProcessBuilder pb = new ProcessBuilder("C:\\Documents and Settings\\Simpatico\\My Documents\\Woerter Speichern Files\\changeBackground", C:\\Documents and Settings\\Simpatico\\My Documents\\Woerter Speichern Files\\testimage.bmp);
		pb.directory(new File("C:\\Documents and Settings\\Simpatico\\My Documents\\Woerter Speichern Files"));
		try {
			pb.start();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
And I get:
java.io.IOException: Cannot run program "C:\Documents and Settings\Simpatico\My Documents\Woerter Speichern Files\changeBackground": CreateProcess error=2, The system cannot find the file specified
	at java.lang.ProcessBuilder.start(Unknown Source)
The problem is with executing the application, changeBackground in the first place, and not the parameter passing.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 20 2009
Added on Aug 22 2009
10 comments
2,142 views