on 06-24-2008 12:03 PM
Hello!
I'm a beginner in Java. I have to call one java-program from my java programm ). I have only .class and .java files. How can I do that?
Hi ,
did u installed ur jdk
if u installed ur jdk set classpath in environment variables .
to run java program
go to ->start-> Run -> type CMD -> enter
u will see command prompt
go to ur workspace
type javac prgname.java
if no errors
type java prgname
it will give o/p
Regards ,
venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
like thuis we can call another java prg ........
import java.io.*;
public class CallHelloPgm
{
public static void main(String args[])
{
Process theProcess = null;
BufferedReader inStream = null;
System.out.println("CallHelloPgm.main() invoked");
// call the Hello class
try
{
theProcess = Runtime.getRuntime().exec("java com.ibm.as400.system.Hello");
}
catch(IOException e)
{
System.err.println("Error on exec() method");
e.printStackTrace();
}
// read from the called program's standard output stream
try
{
inStream = new BufferedReader(
new InputStreamReader( theProcess.getInputStream() ));
System.out.println(inStream.readLine());
}
catch(IOException e)
{
System.err.println("Error on inStream.readLine()");
e.printStackTrace();
}
} // end method
} // end class
Regards ,
venkat
User | Count |
---|---|
84 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.