• 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

Working with Java in Linux - how to execute exe files

 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello, i'm a beginner in using java in linux, maybe you can help me with this problem:

i need to execute an exe file from java...how do i do this? for example i have an application named sga, in linux we execute this as ./sga right? how about if i want to execute it within a java program? apparently, this doesn't work:

Runtime run = Runtime.getRuntime ();
Process pp = run.execute ("./sga");

note that sga and my java code are in the same directory. Am i doing this correctly? thank you. hope you can help me on this one. Will appreciate it a lot!
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Somebody on the ranch referred to this old article, which says one has to redirect the .out and .err PrintStreams. Otherwise what happens is that your ./sga program executes and you don't see any output.

That might be your problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic