Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Working with Java in Linux - how to execute exe files  RSS feed

 
christine clarin
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
  • 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!
 
Campbell Ritchie
Sheriff
Posts: 53750
127
  • Mark post as helpful
  • send pies
  • 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!