Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
Can Java program evoke and run a FORTRAN program directly?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Shawn, post: 2005250"] Thank you. I have got it running, shown below. I will improve it by using ProcessBuilder later. <JAVA> public class DoRuntime { public static void main(String args[]) throws IOException { System.out.println("========JAVA program is going to run a FORTRAN program========"); String cmd = "myscript"; //it contains several commands, including one start FORTRAN Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec(cmd); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; System.out.printf("Output of running %s is:", cmd); while ((line = br.readLine()) != null) { System.out.println(line); } System.out.println("=======JAVA program has finished running a FORTRAN program========="); } } </JAVA> [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
Can Java program evoke and run a FORTRAN program directly?
Top