This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 37953
    
  22
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
 
Similar Threads
its urgent
Running a JAR file from a java program
can u help me out
How to run a exe file from my browser
How to run a commandline command from a java program