• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Executing shell scripts & batch files

 
sekhar variam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I want to execute a daemon process from a java program. but Runtime.getRuntime.exec(scriptName) is not starting the process., where the scriptName is a batch file in NT and a shell script in Unix. There are no exceptions also thrown..The same works well when I am passing and exe file say Notepad.exe in place of the daemon process script name
Thanks in advance
Sekhar
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using something like this:
Runtime.getRuntime().exec("cmd /K start run.bat");
Runtime.getRuntime().exec("cmd /K del run.bat");
(You can look in Windows help under cmd or command for the /K and /c options)
 
sekhar variam
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Cindy..Its working now. ..I hope something similar works for shell scripts also...
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am no Unix person - but I think that the syntax is almost the same . . .
There is a cmd.exe in unix (don't know about the options).
Try: (cmd start whatever.sh)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic