Two Laptop Bag*
The moose likes Beginning Java and the fly likes Working with Java in Linux - how to execute exe files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Working with Java in Linux - how to execute exe files" Watch "Working with Java in Linux - how to execute exe files" New topic
Author

Working with Java in Linux - how to execute exe files

christine clarin
Ranch Hand

Joined: Feb 05, 2005
Posts: 106
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

Joined: Oct 13, 2005
Posts: 38412
    
  23
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Working with Java in Linux - how to execute exe files