This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes execute exe from cmd line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "execute exe from cmd line" Watch "execute exe from cmd line" New topic

execute exe from cmd line

Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
Hi All,
I want to execute a exe from command line through java. I have the following code snippet..

But it throws the following error, when i read the errorstream from the process
'C:\Program' is not recognized as an internal or external command
Do anyone have a better way of doing this?

Thanks & Regards,<br />Nijeesh.
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

Move your *.exe file to a folder path without spaces.

Regards, Rene Larsen
Dropbox Invite
Nijeesh Balan
Ranch Hand

Joined: Oct 09, 2000
Posts: 116
I cannot change the folder settings . Since it is not under my control.
Jeff Langr
Ranch Hand

Joined: May 14, 2003
Posts: 799

to derive the 8.3 (short) name of the directories with spaces. Then try using the shortened path in your command.
For example, "Program Files" usually (always?) translates to "PROGRA~1".

Books: Pragmatic Unit Testing in Java, Agile Java, Modern C++ Programming with TDD, Essential Java Style, Agile in a Flash. Contributor, Clean Code.
Have you checked out Aspose?
subject: execute exe from cmd line
jQuery in Action, 3rd edition