Processbuilder Ioexception Error 2
Contents |
here for a quick overview of the site Help caused by: java.io.ioexception: error=2, no such file or directory jenkins Center Detailed answers to any questions you might have
Java Runtime Error=2 No Such File Or Directory
Meta Discuss the workings and policies of this site About Us Learn more about Stack
Error:java.io.ioexception: Error=2, No Such File Or Directory Android Studio
Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask
Java Processbuilder Error=2 No Such File Or Directory
Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Process Builder java.io.IOException error=2 up vote 0 down vote favorite I want to run a java.io.ioexception: cannot run program jenkins shell command from my Java application. I have compiled a software called "SRILM" and when I run it from shell everything is OK: ngram-count -text /home/istanbul/Desktop/snlp_hmm/model.txt -order 3 -lm hoho.lm However when I run it from my Java application: ProcessBuilder lmBuilder = new ProcessBuilder("ngram-count", "-text", modelPath, "-order", "3", "-lm", "hohom.lm"); lmBuilder.directory(new File("/home/istanbul/srilm/bin/i686-m64")); try { final Process lmProcess = lmBuilder.start(); InputStream is = lmProcess.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) { System.out.println(line); } } catch (IOException e) { e.printStackTrace(); } I get that error: java.io.IOException: Cannot run program "ngram-count" (in directory "/home/istanbul/srilm/bin/i686-m64"): error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041) at org.itu.hmm.AlgorithmRunner.evaluate(AlgorithmRunner.java:127) at org.itu.hmm.ApplicationRunner.main(ApplicationRunner.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.
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 exec user process caused "no such file or directory" docker About Us Learn more about Stack Overflow the company Business Learn more about java processbuilder example hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up java.io.IOException: error=2, No http://stackoverflow.com/questions/29458366/process-builder-java-io-ioexception-error-2 such file or directory up vote 6 down vote favorite I am trying to run a java program from another java program using Runtime.getrunTime().exec Code : String java_home = System.getenv("JAVA_HOME"); String[] command = {""+java_home+"/bin/java -cp -cp /sc/sug/p-lib/* Tdesigner -cd /pr -in ing.rsp -out /scratch/sug/ng.pla -ad -stopO "}; try { proc = Runtime.getRuntime().exec(command); proc.waitFor(); int exitCode = proc.exitValue(); } catch (IOException e) { e.printStackTrace(); } catch http://stackoverflow.com/questions/12904640/java-io-ioexception-error-2-no-such-file-or-directory (InterruptedException e) { e.printStackTrace(); } It gives me following error: java.io.IOException: Cannot run program "/net/sl/sc/jdk6/bin/java -cp /sc/sug/p-lib/* Tdesigner -cd /pr -in ing.rsp -out /scratch/sug/ng.pla -ad -stopOnError ": java.io.IOException: error=2, No such file or directory at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at java.lang.Runtime.exec(Runtime.java:593) at java.lang.Runtime.exec(Runtime.java:466) Can anyone help me to solve the issue. is it that i need to add individual jar files with -cp rather than setting the directory. java share|improve this question asked Oct 15 '12 at 21:55 user1731553 47741122 add a comment| 3 Answers 3 active oldest votes up vote 3 down vote Try removing the extra -cp from the command string array and use individual tokens in the array: String[] command = { java_home + "/bin/java", "-cp", "/sc/sug/p-lib/*", "Tdesigner", "-cd", "/pr", "-in", "ing.rsp", "-out", "/scratch/sug/ng.pla", "-ad", "-stopO" }; share|improve this answer edited Oct 15 '12 at 22:23 answered Oct 15 '12 at 22:17 Reimeus 123k9102166 add a comment| up vote 2 down vote If you use exec(String[]) you must provide the command and its arguments in separate array elements, not all in one as you have done. share|improve this answer answered Oct 15 '12 at 22:02 EJP 198k17143251 String[] command = {
here for a quick overview of the site Help Center Detailed http://stackoverflow.com/questions/14765828/processbuilder-giving-a-file-not-found-exception-when-the-file-does-exist 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 https://github.com/tmullender/ansible-maven-plugin/issues/7 Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join no such the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up ProcessBuilder giving a “File not found” exception when the file does exist [duplicate] up vote 2 down vote favorite 2 This question no such file already has an answer here: Process Builder gives a “No such file or directory” on Mac while Runtime().exec() works fine 1 answer Working on an application that will run on a Linux web server to delete logs from a certain directory, however I keep getting a FileNotFound exception. Here is the code: public static void deleteLOG() { try { ProcessBuilder probuilder = new ProcessBuilder("find /home/root/multicraft/servers/ -name '*.log' -delete"); probuilder.start(); } catch (IOException e) { e.printStackTrace(); } } And the exception java.io.IOException: Cannot run program "find . -name '*CoreData*' -delete" (in directory "/home/root/multicraft/servers"): error=2, No such file or directory at java.lang.ProcessBuilder.start(Unknown Source) at com.mcprohosting.com.nodecleanup.Preprocess.deleteCoreData(Preprocess.java:23) at com.mcprohosting.com.nodecleanup.handlers.CleanupHandler.executeCleanup(CleanupHandler.java:36) at com.mcprohosting.com.main.NodeCleaner.init(NodeCleaner.java:29) at com.mcprohosting.com.main.NodeCleaner.main(NodeCleaner.java:25) Caused by: java.io.IOException: error=2, No such file or directory at java.lang.UNIXProcess.forkAndExec(Native Method) at java.lang.UNIXProcess.
Sign in Pricing Blog Support Search GitHub This repository Watch 1 Star 14 Fork 3 tmullender/ansible-maven-plugin Code Issues 1 Pull requests 0 Projects 0 Pulse Graphs New issue java.io.IOException: error=2, No such file or directory while using ansible from pip installation #7 Open Nereis opened this Issue Jan 19, 2015 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants Nereis commented Jan 19, 2015 While running ansible from jenkins with ansible installed with pip, I get the next stacktrace [INFO] --- ansible-maven-plugin:1.1.2:playbook (ansible-playbook-env-deploy) @ project-name --- [INFO] Command: [ansible-playbook, -i, /opt/jenkins/jenkins-work/workspace/[...]/inventory_jenkins, /opt/jenkins/jenkins-work/workspace/[...]/deploy_env.yml] [ERROR] Failed to execute goal co.escapeideas.maven:ansible-maven-plugin:1.1.2:playbook (ansible-playbook-env-deploy) on project project-name: Unable to run playbook: Cannot run program "ansible-playbook" (in directory "/tmp"): error=2, No such file or directory -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal co.escapeideas.maven:ansible-maven-plugin:1.1.2:playbook (ansible-playbook-env-deploy) on project project-name: Unable to run playbook at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleT