dcsimg
Running an exe which is dependent on other files
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Deepak_Saxena
Posted On:   Monday, March 3, 2003 02:07 PM

HI Tomcat with apache on win 2000. i am trying to run a program in fortran which depends on other files my application requires some input from the user for which i have used JSP pages to run the fortran exe i use a java class with runtime.exec method. i call this method when the user clicks on the the submit button problem is that it doesnot run ... i can run the program using command line and also i can run any other program instead of this fortran program i cant understand where the problem is also ..... since i use the start and stop scripts to start and stop tomcat .... if i run a program to show the current directory   More>>

HI
Tomcat with apache on win 2000.

i am trying to run a program in fortran which depends on other files


my application requires some input from the user for which i have used JSP pages
to run the fortran exe i use a java class with runtime.exec method.



i call this method when the user clicks on the the submit button

problem is that it doesnot run ...
i can run the program using command line
and also i can run any other program instead of this fortran program


i cant understand where the problem is

also .....
since i use the start and stop scripts to start and stop tomcat .... if i run a program to show the current directory it shows up the tom cat installation directory

is there a way to change this path...??

thanx
ds    <<Less

Re: Running an exe which is dependent on other files

Posted By:   James_Bayer  
Posted On:   Monday, March 3, 2003 04:06 PM

I use:

Process p = Runtime.getRuntime().exec( "c:\temp\fortrandir\myfortran.exe", null, "c:\temp\fortrandir\" ) ) ;

to specify the current working directory in which I want to run my program. According to the javadoc:


Executes the specified command and arguments in a separate process with the specified environment and working directory.
If there is a security manager, its checkExec method is called with the first component of the array cmdarray as its argument. This may result in a security exception.

Given an array of strings cmdarray, representing the tokens of a command line, and an array of strings envp, representing "environment" variable settings, this method creates a new process in which to execute the specified command.

If envp is null, the subprocess inherits the environment settings of the current process.

The working directory of the new subprocess is specified by dir. If dir is null, the subprocess inherits the current working directory of the current process.

Parameters:
cmdarray - array containing the command to call and its arguments.
envp - array of strings, each element of which has environment variable settings in format name=value.
dir - the working directory of the subprocess, or null if the subprocess should inherit the working directory of the current process.
About | Sitemap | Contact