Java.io.ioexception Createprocess Error 123
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about processbuilder createprocess error=2, the system cannot find the file specified hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Processbuilder Error=2, No Such File Or Directory
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. java processbuilder cannot run program no such file or directory Join them; it only takes a minute: Sign up ProcessBuilder can't find file?! up vote 8 down vote favorite 1 Another question in quick succession but this has to be a really obvious error that I am not seeing.
Java Processbuilder The System Cannot Find The File Specified
I've written some code to run a batch file below but I'm getting an error message saying it cannot find the file but I can assure you that the file does exist in the directory! public class Pull { public void pullData() throws IOException { ProcessBuilder pb = new ProcessBuilder("adb.bat"); File f = new File("C:\\"); pb.directory(f); Process p = pb.start(); } public static void main(String[] args) throws IOException { Pull pull = new Pull(); pull.pullData(); } } and here createprocess error=2 the system cannot find the file specified java is the error message Exception in thread "main" java.io.IOException: Cannot run program "adb.bat" (in directory "C:\"): CreateProcess error=2, The system cannot find the file specified java batch-file processbuilder share|improve this question asked Mar 23 '12 at 22:23 Rookie 6302912 So, adb.bat is in c:\, right? try placing it or a copy of it in the project folder –keyser Mar 23 '12 at 22:37 doesn't work there either. Am I using processbuilder correctly? –Rookie Mar 23 '12 at 22:47 Have you tried executing the contents of the batch file as the arguments to your ProcessBuilder? E.g., if "adb.bat" does something like "java -version", have you tried doing something like new ProcessBuilder("java","-server")? I'm wondering if Java is trying to treat adb.bat like an executable, even though it's really just a text-based script. –CodeBlind Mar 23 '12 at 22:58 Have you tried including the path in the constructor (eg, new ProcessBuilder("c:\\adb.bat")? See coderanch.com/t/517098/java/java/… –Ash Mar 23 '12 at 23:00 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote I'm running Linux, but the same error occurs when I run your code (modified to run a .sh rather than .bat). Try: ProcessBuilder pb = new ProcessBuilder("c:\\adb.bat"); Apparently using ProcessBuilder.directory doesn't affect the working directory (for the purposes of discovering the executable) that was chosen when the builder was constructed (at least, that's what seems
wasworking fine until one day after a java update http://stackoverflow.com/questions/9847242/processbuilder-cant-find-file from sun. now I get thefollowing errorAn exception occurred when invoking an external process.The cause of this exception was http://macromedia.coldfusion.cfml-general-discussion.narkive.com/KnCQVlsn/java-io-ioexception-error-123 that: java.io.IOException: CreateProcess:"c:\program files\........" error=123. Mr Black 2005-09-16 01:56:08 UTC PermalinkRaw Message Error 123: The filename, directory name, or volume label syntax is incorrect. 1 Reply 5 Views Switch to linear view Disable enhanced parsing Permalink to this page Thread Navigation flux3000 2005-09-16 00:34:42 UTC Mr Black 2005-09-16 01:56:08 UTC about - legalese Loading...
- 15th for workshops, presentations https://issues.jenkins-ci.org/browse/JENKINS-11860 and all things Jenkins Learn more Export Tools JenkinsJENKINS-11860user.dir system property from master (linux) being pulled across to slave (windows)Log In ExportXMLWordPrintable Details Type: Bug Status: Closed Priority: Major Resolution: Incomplete Component/s: fitnesse-plugin Labels: None Environment: createprocess error MASTER: Linux (amd64) SLAVE: Windows XP (x86) Similar Issues: Show Description When running a Fitnesse build on a Windows slave via a Linux master, the command to execute fitnesse is adding "/var/lib/tomcat6/" to the string. This "/var/lib/tomcat6/" the system cannot string would be coming from the Linux master, but cannot figure out from where. How can I prevent this setting from being pulled across to the Windows slave? Console Output: C:\Jenkins\workspace\TEST-Fitnesse-AM>exit 0 hudson.plugins.fitnesse.FitnesseBuilder: {fitnessePortLocal=8085, fitnesseTargetPage=FrontPage, fitnesseTargetIsSuite=true, fitnessePathToJar=Java/fitnesse.jar, fitnesseJavaOpts=, fitnesseHttpTimeout=60000, fitnesseJavaWorkingDirectory=Java, fitnessePathToRoot=FitNesseRoot, fitnesseStart=True, fitnessePathToXmlResultsOut=fitnesse-result.xml} Starting new Fitnesse instance... [Java] $ "/var/lib/tomcat6/C:/Program Files/Java/jdk1.7.0_01/bin/java" -jar /var/lib/tomcat6/C:\Jenkins\workspace\TEST-Fitnesse-AM/Java/fitnesse.jar -d /var/lib/tomcat6/C:\Jenkins\workspace\TEST-Fitnesse-AM -r FitNesseRoot -p 8085 java.io.IOException: Cannot run program "/var/lib/tomcat6/C:/Program Files/Java/jdk1.7.0_01/bin/java" (in directory "\var\lib\tomcat6\C:\Jenkins\workspace\TEST-Fitnesse-AM\Java"): CreateProcess error=123, The filename, directory name, or volume label syntax is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.