Hello,
I am trying to launch and executable file from witin a Java program (under a Windows 98 and Unix platform). I am using the following code to launch the executable using Windows:
import java.io.IOException;
public class WorkingWithExeFiles
{
public static void main(String argv[])
{
Runtime rt = Runtime.getRuntime();
try
{
rt.exec("test2.exe"
;
} catch(IOException ioe){ ioe.printStackTrace();}
System.out.println("\nwhat is wrong"
;
System.exit(0);
}
}
This java file runs and does not produce any errors. However, it does not appear to launch the executable. The executable was developed using Visual C++ and it produces a dos window which asks the user to enter in various values. The exeutable runs fine from windows explorer, but it the code above refuses to work from within Java. Does anybody have any suggestions that might work for both a windows and Unix environment? (I understand that the executable to be lauched from within the Java program must be compliled in each envionment seperately).
thanks
Narjit
I am trying to launch and executable file from witin a Java program (under a Windows 98 and Unix platform). I am using the following code to launch the executable using Windows:
import java.io.IOException;
public class WorkingWithExeFiles
{
public static void main(String argv[])
{
Runtime rt = Runtime.getRuntime();
try
{
rt.exec("test2.exe"
} catch(IOException ioe){ ioe.printStackTrace();}
System.out.println("\nwhat is wrong"
System.exit(0);
}
}
This java file runs and does not produce any errors. However, it does not appear to launch the executable. The executable was developed using Visual C++ and it produces a dos window which asks the user to enter in various values. The exeutable runs fine from windows explorer, but it the code above refuses to work from within Java. Does anybody have any suggestions that might work for both a windows and Unix environment? (I understand that the executable to be lauched from within the Java program must be compliled in each envionment seperately).
thanks
Narjit