|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
IOException while using ProcessBuilder class I tried to start a program within a Java application using the ProcessBuilder class. This is the first time I'm using ProcessBuilder so I have no idea about what is happening...! Here is my code: Code: static void connectToHost(String Host) { ProcessBuilder pb = new ProcessBuilder("connect.exe"), Host); Map<String, String> env = pb.environment(); env.put("SHELLWIDTH", "64"); pb.directory(new File("C:\\MyProgram\\ExApp\\shell")); try ( Process p = pb.start(); } catch (IOException ex) { Logger.getLogger(ShellUtil.class.getName()).log(Level.SEVERE, null, ex); } } When i use this method I get an IOException which says "Cannot run program "connect.exe" (in directory "C:\MyProgram\ExApp\shell"): CreateProcess error=2, The system couldn't find the specified file" Can anyone help me out with this? |
#2
| |||
| |||
Re: IOException while using ProcessBuilder class Hey! Why don't you just provide the full path to connect.exe, rather than just connect.exe around with the system PATH? May be that could help...! Well i'm not at all good at coding...! Anyways, All the best...! |
#3
| |||
| |||
Re: IOException while using ProcessBuilder class Hey! I guess the working directory is not used to search for the executable connect.exe . connect.exe must be located in a directory that is on the 'path'. Well try it out and post if it works....! All the best...! |
![]() |
|
Tags: cannot run program, ioexception, java |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Upgrade Sony Ericsson Xperia Play Micro SD card from class 2 8GB to class 4 32GB | Aaryan2011 | Portable Devices | 8 | 08-10-2011 11:06 PM |
Problem in java.io.IOException | GlassFish | Software Development | 4 | 25-02-2010 03:31 AM |
How to initialize a derived class with an instance of the base class in c#? | KAIRU26 | Software Development | 5 | 12-02-2010 06:23 PM |
Ultra solid drives:Imation M-Class and S-Class | Regina | Portable Devices | 1 | 03-04-2009 10:34 AM |
Good news for CBSE CLASS X & CLASS IX - visit learnnext | surya_expert | Education Career and Job Discussions | 0 | 13-12-2008 12:09 PM |