replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - Jave calling Fortran EXE
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Jave calling Fortran EXE

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Sat Oct 13, 2012 7:25 am    Post subject: Jave calling Fortran EXE Reply with quote

I am attempting to help a PhD student in his research by supplying him with a fortran EXE (+ SALFLIBC.DLL) - 32 bit - which he can call from Java. The routine will read from existing files and write results to a new output file. He can successfully call other 16 and 32 bit EXE's (not fortran based). However when attempting to run even the simple program below (reading from an existing file numbers 1 to 5 and writing the same to a new file) from Java, whilst no error message occur and the Java code reports the program has run OK no output file linktest4 is produced!?

dimension k(5 )
1 format(i4)
open(8,file='linktest.txt')
do 20 j = 1,5
read(8,1)k(j)
20 continue
close(8)
open(9,file='linktest4.txt')
do 30 l=1,5
write(9,1) k(l)
30 continue
close(9)

I appreciate that this is presumably a Java issue - or is there something associated with the fortran that makes calls to run a Fortran based EXE different. Any pointers would be gratefully received

Bill

------

package runexe;

public class Main
{
public static void main(String[] args)
{
try
{
Process proc = Runtime.getRuntime().exec("C:\\cargont\\runcargo.exe");
proc.waitFor();
System.out.println("Execution complete");
}catch(Exception e)
{
e.printStackTrace();
}
}
}
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Sat Oct 13, 2012 8:04 am    Post subject: Reply with quote

I would start with only PRINT*,Hello' in the Fortran code.
Also is the exception being raised in the Java?

Maybe the Fortran exe cannot "see" salflibc.dll.
Back to top
View user's profile Send private message AIM Address
BILLDOWS



Joined: 22 Jul 2005
Posts: 86
Location: Swansea, UK

PostPosted: Sun Oct 14, 2012 10:34 am    Post subject: Reply with quote

Thanks Paul.

Solved - In the end it transpired that whilst the call to the EXE - which did have to give the full path reference as per the Java in the original posting - was essential, what the student had failed to do was place the Java plus the EXE plus the salflubc.dll and data files ALL in the same folder - as I had suggested!! The addition of 'prints' helped identy this. Having the student machine 200 miles away does not help!

Thanks again

Bill
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group