This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Problems with Runtime.getRuntime().exec()

 
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?
 
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.
 
Trust God, but always tether your camel... to this tiny ad.
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!