Results 1 to 5 of 5
- 05-19-2009, 03:32 PM #1
[SOLVED] How to give the path when there exists spaces
Hi Folks,
How to give the path when there exists spaces in that.
ex:
it is running perfect..import java.io.*;
class batrun{
public static void main(String arg[]){
try{
String command = "cmd /C start C:/myapp.exe ";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
}catch (IOException e) {
e.printStackTrace();
}
}
}
but when i give
it is not recognizing the path.import java.io.*;
class batrun{
public static void main(String arg[]){
try{
//String command = "cmd /C start C:/myapp.exe ";
String command = "cmd /C start C:/Program Files/application/myapp.exe";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
}catch (IOException e) {
e.printStackTrace();
}
}
}visit : www.yoteam.co.cc
- 05-19-2009, 08:28 PM #2
put in quotes and esc it.
Java Code:String command = "cmd /C start \"C:/Program Files/application/myapp.exe\"";
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 05-20-2009, 07:09 AM #3
When i run with the above given code it opens another command prompt window with the given path ..please find the attachment.
can any body help me in this?visit : www.yoteam.co.cc
- 05-20-2009, 08:12 AM #4
Hi,
Could you remove 'start' and try once?Ramya:cool:
- 05-20-2009, 08:32 AM #5
Similar Threads
-
how can i give a file path to java stream ?
By sheckoo in forum New To JavaReplies: 2Last Post: 11-05-2008, 08:42 AM -
How to check whether file is exists or not
By Java Tip in forum java.ioReplies: 0Last Post: 04-05-2008, 10:13 AM -
Check if a web page exists or not
By Java Tip in forum Java TipReplies: 0Last Post: 03-02-2008, 07:24 PM -
Load URL that contains spaces?
By barkster in forum Java AppletsReplies: 0Last Post: 01-30-2008, 09:40 PM -
How an array can check that profile whether exists or not???
By hien_NU in forum New To JavaReplies: 1Last Post: 01-10-2008, 01:18 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks