Hi,
I am a Java programmer. Recently I need to build a Java gui which calls
Fortran programs doing computation. Could anybody give me some
suggestions how to get start with this?
OK, approaches.
(i) Have the Fortran program open a port and listen on it. Have the GUI
talk to the Fortran program on that port. You'll need to develop a
protocol, and parsing the protocol at both ends is an overhead, but it
saves an awful lot of tricky code. This is what I would do because it
looks easiest to me.
(ii) Use a Fortran compiler that compiles to JVM. University of Tenesse
have one called f2j, but I don't know how complete it is:
http://icl.cs.utk.edu/f2j/overview/index.html
(iii) Use the GNU C compiler to compile Fortran for the JVM. Sounds
bizarre, but should be possible as GCC has JVM as one of the processors it
supports and Fortran 77 as one of the languages it supports.
(iv) Craft glue code using JNI. This is the 'official' way of doing it, but
my guess is that it would quickly get dark and dirty.