This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "cant find file error" Watch "cant find file error" New topic
Author

cant find file error

Adamz Preston
Greenhorn

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:

java.io.IOException: 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(Test.java:11)
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)
... 2 more


and here is the code, please help

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19684
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2251
    
  47
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: http://aspose.com/file-tools
 
subject: cant find file error