English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

how to call another java file using button click

how to call another java file from within my current java file


Pls reply .. thank you

2006-10-26 17:25:22 · 2 answers · asked by JaYaNtH 3 in Computers & Internet Programming & Design

2 answers

I agree with arbiet,but the following program will help you int running a program/process concurrently.I think the questioner
is asking a similar one..?
you need to know about the Runtime and Process classes for this purpose.
try this....
Process p = null;
try
{
Runtime r=Runtime.getRuntime();
p=r.exec("java ");
}catch(Exception e){
}

good luck.

2006-10-26 18:40:41 · answer #1 · answered by Anand 3 · 4 0

Anand might be making things a little too complex. He's telling you how to run a separate java program, but is that what you mean?

You've already got a .java file that has a main() method in it. Did you know that you can write another class in another .java file that has no main() method, and then use that class in your first file? In fact, this is normal usage for java programs.

Try it and see if it's what you want.

2006-10-28 06:50:00 · answer #2 · answered by arbeit 4 · 1 0

fedest.com, questions and answers