Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cant find file error

 
Adamz Preston
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tony Docherty
Bartender
Posts: 2952
59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Notepad is normally on the PATH so you don't need to specify the directory. The following will work on most Win systems:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic