Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

execute exe from cmd line

 
Nijeesh Balan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Move your *.exe file to a folder path without spaces.
Ren´┐Ż
 
Nijeesh Balan
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot change the folder settings . Since it is not under my control.
 
Jeff Langr
author
Ranch Hand
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use

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".
-Jeff-
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic