aspose file tools*
The moose likes Java in General and the fly likes Problem running exe file in program files thru java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem running exe file in program files thru java" Watch "Problem running exe file in program files thru java" New topic
Author

Problem running exe file in program files thru java

prashant komaragiri
Ranch Hand

Joined: Jan 23, 2001
Posts: 36
Hi All,
I am involved in an application where i need to run exe file thru java but the problem is if the directory has spaces between it like d:\Progam Files it doesnot run. So while running it only checks d:\program and not d:\program files, my code is Like this :
String sysCommand = new String("cmd /c start Synlook -F SyncXML.xml -A Import");
...
...
Runtime r = Runtime.getRuntime();
Process p = r.exec(sysCommand);
synlook is my exe file and rest are parameters.
prashant


Sun Certified Programmer for Java 2 Platform
Sean MacLean
author
Ranch Hand

Joined: Nov 07, 2000
Posts: 621
You can reference the directory by it's DOS name (on Windows) where "program files" = "progra~1" (and if you have a new folder call programmitic it would probably be progra~2, etc.).
Sean
prashant komaragiri
Ranch Hand

Joined: Jan 23, 2001
Posts: 36
Hi Sean,
thats true but, this works out fine when i know the directory in which the exe file is going to be installed ,This is an installable application so i don't know where the user is going to install it.Thanks for the response.
Prashant
Bill Siggelkow
Ranch Hand

Joined: Jun 27, 2001
Posts: 57
You could just document that the user should add the directory to the PATH


Bill Siggelkow
Jade Cove Solutions
 
 
subject: Problem running exe file in program files thru java
 
Similar Threads
Running a .exe from java program
Run .exe using multithreading
.class file into .exe file
How to run a exe file in java by taking parameters
Problem with running a program from Java file