• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with Runtime.getRuntime().exec()  RSS feed

 
Aaron Robinson
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having problem getting this method to run executables on NT workstation. Is anyone aware of any problems with using this method? I have tried calling it from a servlet and a session bean eith the following code but neither appear to work.
Runtime.getRuntime().exec("c:\\windows\\notepad");
Also, this code will need to be deployed to Solaris. what is the platform independent way of calling an executable, in particular how do you specify the root in an independent way?
 
Edward Man
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
Did you try
Runtime.getRuntime().exec("notepad.exe");
or
Runtime.getRuntime().exec("c:\\winnt\\notepad.exe");
I believe Java in both NT and Unix/Linux will try to search all paths specified in the PATH environment variable. It is better not to put in paths in the exec() function.
 
Aaron Robinson
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Edward,
Did indeed and it worked. What a dork.
Thanks for the relpy.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!