aspose file tools
The moose likes I/O and Streams and the fly likes cant find file error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "cant find file error" Watch "cant find file error" New topic

cant find file error

Adamz Preston

Joined: Jan 19, 2013
Posts: 29
Hi, trying to run a process directly from java to see if it works... this is what comes up: Cannot run program "C:\Documents and Settings\MOTIVE\Start Menu\Programs\Accessories\notepad.exe": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at mc.Test.main(
Caused by: 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)
... 2 more

and here is the code, please help

Rob Spoor

Joined: Oct 27, 2005
Posts: 19849

You're trying to run notepad from the Start Menu, but that contains a shortcut (.lnk file) and not an executable (.exe file). Either call the shortcut, or fix the path to call the executable correctly.

How To Ask Questions How To Answer Questions
Tony Docherty

Joined: Aug 07, 2007
Posts: 2523
Notepad is normally on the PATH so you don't need to specify the directory. The following will work on most Win systems:

I agree. Here's the link:
subject: cant find file error