Runtime & Process class

F

frank

I am trying to run the process in the seperate environonment using the
runtime class as follows

Runtime rt;
Process p,p1;
rt=Runtime.getRuntime();
p=rt.exec("javac samp.java");
p1=rt.exec("java
samp);
the samp program is to get two arguments using the InputStreamReader
and add it.
I need to pass the two arguments from current program to
sample.java.so plz help me.
 
M

Manish Pandit

I am trying to run the process in the seperate environonment using the
runtime class as follows

Runtime rt;
Process p,p1;
rt=Runtime.getRuntime();
p=rt.exec("javac samp.java");
p1=rt.exec("java
samp);
the samp program is to get two arguments using the InputStreamReader
and add it.
I need to pass the two arguments from current program to
sample.java.so plz help me.

Not that what you're trying to do is unachievable, but is there a
reason that you have to compile samp.java from within this code? If
you can have samp.java precompiled, you can just do:

new samp().main(new String[]{argument0,argument1});

-cheers,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top