• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with Runtime.getRuntime().exec()

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Edward,
Did indeed and it worked. What a dork.
Thanks for the relpy.
 
reply
    Bookmark Topic Watch Topic
  • New Topic