prasad2000
asked on
how to invoke an exe file thro a java program??
am writing a java program which invokes an exe file present in my system.
can anyone help me to solve it.
one more question is how to pass parameters to the exe program.
thx in advance
can anyone help me to solve it.
one more question is how to pass parameters to the exe program.
thx in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi ovi
thx for the solution.
its working fine.
for ex if i want to run calc.exe file
public class AppRunner {
public static void main(String[] args) {
String app = "calc";
try {
Process process = Runtime.getRuntime().exec( app);
} catch(Exception e) {}
}
}
this opens calc.exe
but if i want to set some integer instead of 0 which is by default.
is it possible??if so how?
thx for the solution.
its working fine.
for ex if i want to run calc.exe file
public class AppRunner {
public static void main(String[] args) {
String app = "calc";
try {
Process process = Runtime.getRuntime().exec(
} catch(Exception e) {}
}
}
this opens calc.exe
but if i want to set some integer instead of 0 which is by default.
is it possible??if so how?
I think not. If you run in the command line 'calc.exe 1' you will not get the 1 integer on the calculator input line. So the problem is at the calc.exe program which does not accept parameters.
So, what about some points ?
public class AppRunner {
public static void main(String[] args) {
String app = "notepad AppRunner.java";
try {
Process process = Runtime.getRuntime().exec(
} catch(Exception e) {}
}
}
Just run "javac AppRunner.java" followed by "java AppRunner"