Executing Another Exe
Hi all,
i am executing another jar file with the following code:
Runtime run = Runtime.getRuntime();
try{
Process python = run.exec("C:\\WINDOWS\\notepad.exe");
python.waitFor();
BufferedReader in =new BufferedReader
(new InputStreamReader(python.getInputStream()) );
String line;
while ((line = in.readLine()) !=null){
System.out.print(line);
}
}catch (Exception e){
System.out.println(e.getMessage());
}
The questin is: The mother prosses waiting for ending the child process. I want to execute my program to another process and after that exit.
It is not necessary that using process. I only want to execute the another executable file and exit.
Thans for your replys.
[1166 byte] By [
yasin1499a] at [2007-11-27 11:57:17]

> The questin is: The mother prosses waiting for ending
> the child process.
Well, no kidding. What do you suppose this line of code does?
> python.waitFor();
If you don't want it to waitFor that other process to end, then don't call that method.
warnerja: Yes you are right. It was a mistake while i was copying it. Normally there is no waitfor() function call and mother process waits for the children too.
> you try System.exit(1)?
Yes, i tried after you said, but didn't work.
> warnerja: Yes you are right. It was a mistake while i
> was copying it. Normally there is no waitfor()
> function call and mother process waits for the
> children too.
If you are having a problem then POST YOUR REAL code.
There is no point on our guessing what might be wrong from code you invented for us that is not your real code. That's utterly pointless and a waste of everyone's time.
> > warnerja: Yes you are right. It was a mistake while
> i
> > was copying it. Normally there is no waitfor()
> > function call and mother process waits for the
> > children too.
>
> If you are having a problem then POST YOUR REAL code.
>
>
> There is no point on our guessing what might be wrong
> from code you invented for us that is not your real
> code. That's utterly pointless and a waste of
> everyone's time.
If i were post my real code, it would be waste of time. Because it is very complex. So, i am not trying to correct my own code too. I am trying upgrade the code which i posted you. Because it is more clear and i know what i want. It makes no matter between two code logicly.The only diffirence is my code is much more confusing due to its complexity and lenguage(the fuctions and variables are not English).
> > > warnerja: Yes you are right. It was a mistake
> while
> > i
> > > was copying it. Normally there is no waitfor()
> > > function call and mother process waits for the
> > > children too.
> >
> > If you are having a problem then POST YOUR REAL
> code.
> >
> >
> > There is no point on our guessing what might be
> wrong
> > from code you invented for us that is not your
> real
> > code. That's utterly pointless and a waste of
> > everyone's time.
>
> If i were post my real code, it would be waste of
> time. Because it is very complex. So, i am not trying
> to correct my own code too. I am trying upgrade the
> code which i posted you. Because it is more clear and
> i know what i want. It makes no matter between two
> code logicly.The only diffirence is my code is much
> more confusing.
Your logic is extremely faulty.Confused and poorly written code is the very cause of your error.
Until such time as you are willing to post you real code go away. There is no point in wasting our time with your nonsense.
> If i were post my real code, it would be waste of
> time. Because it is very complex.
Fair enough. So post a small piece of code that actually demonstrates the question you are asking. Try it before you post.
> > > > warnerja: Yes you are right. It was a mistake
> > while
> > > i
> > > > was copying it. Normally there is no waitfor()
> > > > function call and mother process waits for the
> > > > children too.
> > >
> > > If you are having a problem then POST YOUR REAL
> > code.
> > >
> > >
> > > There is no point on our guessing what might be
> > wrong
> > > from code you invented for us that is not your
> > real
> > > code. That's utterly pointless and a waste of
> > > everyone's time.
> >
> > If i were post my real code, it would be waste of
> > time. Because it is very complex. So, i am not
> trying
> > to correct my own code too. I am trying upgrade
> the
> > code which i posted you. Because it is more clear
> and
> > i know what i want. It makes no matter between two
> > code logicly.The only diffirence is my code is
> much
> > more confusing.
>
> Your logic is extremely faulty.Confused and poorly
> written code is the very cause of your error.
>
> Until such time as you are willing to post you real
> code go away. There is no point in wasting our time
> with your nonsense.
Are you a joke? I said you the code has NonEnglish functions and variables. And you are not the one who can say me go away.
If you don't think to help, you can go away.
> > > > > warnerja: Yes you are right. It was a
> mistake
> > > while
> > > > i
> > > > > was copying it. Normally there is no
> waitfor()
> > > > > function call and mother process waits for
> the
> > > > > children too.
> > > >
> > > > If you are having a problem then POST YOUR
> REAL
> > > code.
> > > >
> > > >
> > > > There is no point on our guessing what might
> be
> > > wrong
> > > > from code you invented for us that is not your
> > > real
> > > > code. That's utterly pointless and a waste of
> > > > everyone's time.
> > >
> > > If i were post my real code, it would be waste
> of
> > > time. Because it is very complex. So, i am not
> > trying
> > > to correct my own code too. I am trying upgrade
> > the
> > > code which i posted you. Because it is more
> clear
> > and
> > > i know what i want. It makes no matter between
> two
> > > code logicly.The only diffirence is my code is
> > much
> > > more confusing.
> >
> > Your logic is extremely faulty.Confused and poorly
> > written code is the very cause of your error.
> >
> > Until such time as you are willing to post you
> real
> > code go away. There is no point in wasting our
> time
> > with your nonsense.
>
> Are you a joke? I said you the code has NonEnglish
> functions and variables. And you are not the one who
> can say me go away.
> If you don't think to help, you can go away.
You are a joke.
Nobody can help you. You're too ******* stupid.
My English is not very good. I hope i understood you correctly. My problem is for only about prosess' simply behavior. I want my mother prosess to create a new child prosess and kill. Thats all.
>
> You are a joke.
>
> Nobody can help you. You're too ******* stupid.
Suck my ****!
> My English is not very good. I hope i understood you
> correctly. My problem is for only about prosess'
> simply behavior. I want my mother prosess to create a
> new child prosess and kill. Thats all.
Stop calling waitFor!
Oh wait... that's not your real code.
Fuckwit.
> >
> > You are a joke.
> >
> > Nobody can help you. You're too ******* stupid.
>
> Suck my ****!
Glad to see your English is improving, if not your intelligence.
> > My English is not very good. I hope i understood
> you
> > correctly. My problem is for only about prosess'
> > simply behavior. I want my mother prosess to create
> a
> > new child prosess and kill. Thats all.
>
> Stop calling waitFor!
>
> Oh wait... that's not your real code.
>
> Fuckwit.
You are a really stupid man. If you read top, you can anderstand i am not calling the waitfor!
> > >
> > > You are a joke.
> > >
> > > Nobody can help you. You're too ******* stupid.
> >
> > Suck my ****!
>
> Glad to see your English is improving, if not your
> intelligence.
Yes, i am falulmounted with faulmounted, stupid with stupid. Thanks for you make me taste stupidity.
> > > My English is not very good. I hope i understood
> > you
> > > correctly. My problem is for only about prosess'
> > > simply behavior. I want my mother prosess to
> create
> > a
> > > new child prosess and kill. Thats all.
> >
> > Stop calling waitFor!
> >
> > Oh wait... that's not your real code.
> >
> > Fuckwit.
>
> You are a really stupid man. If you read top, you can
> anderstand i am not calling the waitfor!
You are lying.
> > > > My English is not very good. I hope i
> understood
> > > you
> > > > correctly. My problem is for only about
> prosess'
> > > > simply behavior. I want my mother prosess to
> > create
> > > a
> > > > new child prosess and kill. Thats all.
> > >
> > > Stop calling waitFor!
> > >
> > > Oh wait... that's not your real code.
> > >
> > > Fuckwit.
> >
> > You are a really stupid man. If you read top, you
> can
> > anderstand i am not calling the waitfor!
>
> You are lying.
I amn not obliged to make you trust me. I know it is true, it is enough for me.
> > > > > My English is not very good. I hope i
> > understood
> > > > you
> > > > > correctly. My problem is for only about
> > prosess'
> > > > > simply behavior. I want my mother prosess to
> > > create
> > > > a
> > > > > new child prosess and kill. Thats all.
> > > >
> > > > Stop calling waitFor!
> > > >
> > > > Oh wait... that's not your real code.
> > > >
> > > > Fuckwit.
> > >
> > > You are a really stupid man. If you read top,
> you
> > can
> > > anderstand i am not calling the waitfor!
> >
> > You are lying.
>
> I amn not obliged to make you trust me. I know it is
> true, it is enough for me.
Do you ever plan on posting your real code?
If we are all finished yelling at each other...
yasin 1499,
There is a bug in the code you wrote but I don't see how we can help you if we don't see what it is. Please post the formatted code of the relevent portion of your code so that we can guide you.
> Do you ever plan on posting your real code?
What makes difference? Anyway, you spoilt the topic. Who help after these conversations?
> There is a bug in the code you wrote but I don't see
> how we can help you if we don't see what it is.
> Please post the formatted code of the relevent
> portion of your code so that we can guide you.
Ok brother.
public void başlangıcaİşle(int index){
File update=new File("Update.exe");
File kopya=new File(kullanıcıDizinleri.get(index),"Start Menu\\Programlar\\Başlangı\\Update.exe");
dosyayıKopyala(update, kopya);
Runtime run = Runtime.getRuntime();
try {
Process python = run.exec(kopya.getPath());
python.waitFor();
BufferedReader in = new BufferedReader
( new InputStreamReader(python.getInputStream()) );
String line;
while ((line = in.readLine()) != null) {
System.out.print(line);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void dosyayıKopyala(File in,File out){
FileInputStream fis=null;
FileOutputStream fos=null;
try {
fis = new FileInputStream(in);
fos = new FileOutputStream(out);
}
catch (FileNotFoundException e) {
System.exit(0);
}
byte[] buf = new byte[1024];
int i = 0;
try {
while((i=fis.read(buf))!=-1){
try {
fos.write(buf, 0, i);
}
catch (IOException e) {
System.exit(0);
}
}
}
catch (IOException e1) {
System.exit(0);
}
try {
fis.close();
fos.close();
}
catch (IOException e) {
System.exit(0);
}
}
> > There is a bug in the code you wrote but I don't
> see
> > how we can help you if we don't see what it is.
> > Please post the formatted code of the relevent
> > portion of your code so that we can guide you.
>
> Ok brother.
>
> public void balangcale(int
> index){
> File update=new File("Update.exe");
>
> File kopya=new
> ew
> File(kullancDizinleri.get(index),"Start
> Menu\\Programlar\\Balang\\Update.exe");
> dosyayKopyala(update, kopya);
>
> Runtime run = Runtime.getRuntime();
> try {
> Process python = run.exec(kopya.getPath());
> python.waitFor();
> BufferedReader in = new BufferedReader
> ( new InputStreamReader(python.getInputStream())
> ()) );
> String line;
> while ((line = in.readLine()) != null) {
> System.out.print(line);
> }
> } catch (Exception e) {
> System.out.println(e.getMessage());
> }
> }
> public void dosyayKopyala(File in,File out){
> FileInputStream fis=null;
> FileOutputStream fos=null;
> try {
> fis = new FileInputStream(in);
> fos = new FileOutputStream(out);
> }
> catch (FileNotFoundException e) {
> System.exit(0);
> }
>
> byte[] buf = new byte[1024];
> int i = 0;
> try {
> while((i=fis.read(buf))!=-1){
> try {
> fos.write(buf, 0, i);
> }
> catch (IOException e) {
> System.exit(0);
> }
> }
> }
> catch (IOException e1) {
> System.exit(0);
> }
> try {
> fis.close();
> fos.close();
> }
> catch (IOException e) {
> System.exit(0);
> }
> }
So after all that it turns out that you are in fact lying. You are calling waitFor!
Jeebus H. Christ you are an arrogant fuckwit.
> > There is a bug in the code you wrote but I don't
> see
> > how we can help you if we don't see what it is.
> > Please post the formatted code of the relevent
> > portion of your code so that we can guide you.
>
> Ok brother.
>
> public void balangcale
Please in future when you post code take care to use the code formatting tags. It makes your code easier to read.
I could not help but notice the following lines in your code.
Process python = run.exec(kopya.getPath());
python.waitFor();
If you do not want to wait then you should stop calling the waitFor method of process.
> So after all that it turns out that you are in fact
> lying. You are calling waitFor!
>
> Jeebus H. Christ you are an arrogant fuckwit.
Yes , you proved that you are really very stupid. I TOLD YOU I AM NOT TRYING TO UPGRADE THIS CODE,I AM TRYING ON THE CODE THAT I POSTED.
Do you understand stupid fuckwit?
> Please in future when you post code take care to use
> the code formatting tags. It makes your code easier
> to read.
>
> I could not help but notice the following lines in
> your code.
>
> Process python = run.exec(kopya.getPath());
> python.waitFor();
>
> If you do not want to wait then you should stop
> calling the waitFor method of process.
Ok brother. But i tried 100 times to stop calling waitfor. It makes no difference.
> > So after all that it turns out that you are in
> fact
> > lying. You are calling waitFor!
> >
> > Jeebus H. Christ you are an arrogant fuckwit.
>
> Yes , you proved that you are really very stupid. I
> TOLD YOU I AM NOT TRYING TO UPGRADE THIS CODE,I AM
> TRYING ON THE CODE THAT I POSTED.
THE CODE THAT YOU POSTED USES WAITFOR. PLEASE INDICATE WHICH POST IN THIS THREAD YOU POSTED CODE THAT DOES NOT USE WAIT FOR
> > Please in future when you post code take care to
> use
> > the code formatting tags. It makes your code
> easier
> > to read.
> >
> > I could not help but notice the following lines in
> > your code.
> >
> > Process python = run.exec(kopya.getPath());
> > python.waitFor();
> >
> > If you do not want to wait then you should stop
> > calling the waitFor method of process.
>
> Ok brother. But i tried 100 times to stop calling
> waitfor. It makes no difference.
Would it be possible for you to post the code that you are actually using then? The one where you are not calling waitfor?
> > Please in future when you post code take care to
> use
> > the code formatting tags. It makes your code
> easier
> > to read.
> >
> > I could not help but notice the following lines in
> > your code.
> >
> > Process python = run.exec(kopya.getPath());
> > python.waitFor();
> >
> > If you do not want to wait then you should stop
> > calling the waitFor method of process.
>
> Ok brother. But i tried 100 times to stop calling
> waitfor. It makes no difference.
Here we go again...
> > Ok brother. But i tried 100 times to stop calling
> > waitfor. It makes no difference.
>
> Would it be possible for you to post the code that
> you are actually using then? The one where you are
> not calling waitfor?
Otherwise I can only guess that you are having trouble with the streams attached to the process. For example you are not sending data to the process through the output stream.
You should probably read this article which explains many of the common pitfalls and problems people have when they use Runtime.exec
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
> > > So after all that it turns out that you are in
> > fact
> > > lying. You are calling waitFor!
> > >
> > > Jeebus H. Christ you are an arrogant fuckwit.
> >
> > Yes , you proved that you are really very stupid.
> I
> > TOLD YOU I AM NOT TRYING TO UPGRADE THIS CODE,I AM
> > TRYING ON THE CODE THAT I POSTED.
>
> THE CODE THAT YOU POSTED USES WAITFOR. PLEASE
> INDICATE WHICH POST IN THIS THREAD YOU POSTED CODE
> THAT DOES NOT USE WAIT FOR
Before i was not writing to you, i said i tried, but it maked any diffirence. I tried not calling the waitfor function 100 times before and after i wrote here. Can you really understand?
Now,I am really bored of your stupidness. Don't bother me more.I want to learn my fault on my code.
> Don't
> bother me more.I want to learn my fault on my code.
Then post the code you are using, preferably as a self contained example that illustrates the problem.
> > > > So after all that it turns out that you are in
> > > fact
> > > > lying. You are calling waitFor!
> > > >
> > > > Jeebus H. Christ you are an arrogant fuckwit.
> > >
> > > Yes , you proved that you are really very
> stupid.
> > I
> > > TOLD YOU I AM NOT TRYING TO UPGRADE THIS CODE,I
> AM
> > > TRYING ON THE CODE THAT I POSTED.
> >
> > THE CODE THAT YOU POSTED USES WAITFOR. PLEASE
> > INDICATE WHICH POST IN THIS THREAD YOU POSTED CODE
> > THAT DOES NOT USE WAIT FOR
>
> Before i was not writing to you, i said i tried, but
> it maked any diffirence. I tried not calling the
> waitfor function 100 times before and after i wrote
> here. Can you really understand?
> Now,I am really bored of your stupidness. Don't
> bother me more.I want to learn my fault on my code.
YOU ARE QUITE POSSIBLY THE DUMBEST POSTER EVER. CONSIDERING THE COMPETITION AROUND HERE THAT'S A VERY IMPRESSIVE ACHIEVEMENT. I AM SURE YOU MUST BE PROUD
> > Would it be possible for you to post the code that
> > you are actually using then? The one where you are
> > not calling waitfor?
>
> Otherwise I can only guess that you are having
> trouble with the streams attached to the process. For
> example you are not sending data to the process
> through the output stream.
>
> You should probably read this article which explains
> many of the common pitfalls and problems people have
> when they use Runtime.exec
>
> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
> traps.html
Yes, it would be the problem. But how can i send data to the process through the output stream?
> > Don't
> > bother me more.I want to learn my fault on my
> code.
>
> Then post the code you are using, preferably as a
> self contained example that illustrates the problem.
Good luck!
> > > Would it be possible for you to post the code
> that
> > > you are actually using then? The one where you
> are
> > > not calling waitfor?
> >
> > Otherwise I can only guess that you are having
> > trouble with the streams attached to the process.
> For
> > example you are not sending data to the process
> > through the output stream.
> >
> > You should probably read this article which
> explains
> > many of the common pitfalls and problems people
> have
> > when they use Runtime.exec
>
> >
> >
> http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-
>
> > traps.html
>
> Yes, it would be the problem. But how can i send data
> to the process through the output stream?
Please read the article I linked.
> YOU ARE QUITE POSSIBLY THE DUMBEST POSTER EVER.
> CONSIDERING THE COMPETITION AROUND HERE THAT'S A VERY
> IMPRESSIVE ACHIEVEMENT. I AM SURE YOU MUST BE
> PROUD
Yes, i am thinking the same about you as the dumbest person.
It is enough today to writing idiots. Bye
> > Don't
> > bother me more.I want to learn my fault on my
> code.
>
> Then post the code you are using, preferably as a
> self contained example that illustrates the problem.
I posted it. The second code is the code i am using.
> > YOU ARE QUITE POSSIBLY THE DUMBEST POSTER EVER.
> > CONSIDERING THE COMPETITION AROUND HERE THAT'S A
> VERY
> > IMPRESSIVE ACHIEVEMENT. I AM SURE YOU MUST BE
> > PROUD
>
> Yes, i am thinking the same about you as the
> dumbest person.
> It is enough today to writing idiots. Bye
I don't think that's a very fair statement to make, you have been less than forthcoming about your problem.
> > > Don't
> > > bother me more.I want to learn my fault on my
> > code.
> >
> > Then post the code you are using, preferably as a
> > self contained example that illustrates the
> problem.
>
> I posted it. The second code is the code i am using.
Oh. My. God.
You just finished saying it wasn't the code.
It is the code. It isn't the code.
Make up your ******* mind !
wow, this thread amuses me.
so much name calling.
you are a fuckwit.
> wow, this thread amuses me.
> so much name calling.
> you are a fuckwit.
Good, but not quite haiku.
> > > YOU ARE QUITE POSSIBLY THE DUMBEST POSTER
> EVER.
> > > CONSIDERING THE COMPETITION AROUND HERE THAT'S A
> > VERY
> > > IMPRESSIVE ACHIEVEMENT. I AM SURE YOU MUST BE
> > > PROUD
> >
> > Yes, i am thinking the same about you as the
> > dumbest person.
> > It is enough today to writing idiots. Bye
>
> I don't think that's a very fair statement to make,
> you have been less than forthcoming about your
> problem.
Yes i know. But, he started to insult. Then i answered. I am sorry about my words. But he drove me mad.
> > Do you ever plan on posting your real code?
>
> What makes difference?
I nominate this as post of the year.
Yashin, give up programming buddy. You are not cut out for it.
> > > > Don't
> > > > bother me more.I want to learn my fault on my
> > > code.
> > >
> > > Then post the code you are using, preferably as
> a
> > > self contained example that illustrates the
> > problem.
> >
> > I posted it. The second code is the code i am
> using.
>
> Oh. My. God.
>
> You just finished saying it wasn't the code.
>
> It is the code. It isn't the code.
>
> Make up your ******* mind !
I had mistakes about tenses, as you can see my English is not good. Whetever i say, you will never understand me. Now **** you, i dont want to struggle with you.
OP:
you should post the code which is breaking, and all will be well.
> > > > YOU ARE QUITE POSSIBLY THE DUMBEST POSTER
> > EVER.
> > > > CONSIDERING THE COMPETITION AROUND HERE THAT'S
> A
> > > VERY
> > > > IMPRESSIVE ACHIEVEMENT. I AM SURE YOU MUST BE
> > > > PROUD
> > >
> > > Yes, i am thinking the same about you as the
> > > dumbest person.
> > > It is enough today to writing idiots. Bye
> >
> > I don't think that's a very fair statement to
> make,
> > you have been less than forthcoming about your
> > problem.
>
> Yes i know. But, he started to insult. Then i
> answered. I am sorry about my words. But he drove me
> mad.
Just go and read that article I posted. It has examples of reading and writing with Process related streams.
> > > Don't
> > > bother me more.I want to learn my fault on my
> > code.
> >
> > Then post the code you are using, preferably as a
> > self contained example that illustrates the
> problem.
>
> I posted it. The second code is the code i am using.
Then, as you keep being told, to start with the waitFor() call is in the wrong place.
What is stopping you posting a stand alone example that illustrates the problem?
yasin,
what is your 1st language?
> > > > > Don't
> > > > > bother me more.I want to learn my fault on
> my
> > > > code.
> > > >
> > > > Then post the code you are using, preferably
> as
> > a
> > > > self contained example that illustrates the
> > > problem.
> > >
> > > I posted it. The second code is the code i am
> > using.
> >
> > Oh. My. God.
> >
> > You just finished saying it wasn't the code.
> >
> > It is the code. It isn't the code.
> >
> > Make up your ******* mind !
>
> I had mistakes about tenses, as you can see my
> English is not good. Whetever i say, you will never
> understand me. Now **** you, i dont want to struggle
> with you.
English is not your problem. Lying is your problem.
Sabre asked you to post the code you are using. You said you are using the code you posted. But you also say you are not using the code you posted.
This is not a tense problem. This is a problem of deliberate obtuseness. Post your actual code, the actual code that you are actually using actually now.
This isn't rocket science.
PS fuck you too
> > > Do you ever plan on posting your real code?
> >
> > What makes difference?
>
> I nominate this as post of the year.
>
> Yashin, give up programming buddy. You are not cut
> out for it.
Can you understand the differences between two:
"What makes difference?"
v.s
"What makes difference? Anyway, you spoilt the topic. Who help after these conversations?"
Thats enough really, i will really be very rude.
> Thats enough really, i will really be very rude.
Oh goodie.
>> Post your actual code, the actual code that you are actually using actually now.
****. George just got kicked off the top of the "best response of
the week" list, lol.
> English is not your problem. Lying is your problem.
>
> Sabre asked you to post the code you are using. You
> said you are using the code you posted. But you also
> say you are not using the code you posted.
>
> This is not a tense problem. This is a problem of
> deliberate obtuseness. Post your actual code, the
> actual code that you are actually using actually
> now.
>
> This isn't rocket science.
>
> PS **** you too
I have posted two codes. You are confising which i want to explain.So , i am not telling it well too. If the problem was waitfor, why would i be here? It is not the problem. There is another problem and i am serchng for it. Now dont bother me please
> yasin,
> what is your 1st language?
Turkish
1) give us the code you are using right now, fuckwit!
2) please give us the code that you are using right now, not the code you just made up
3) ******* ******* you **** give us motherfucking code you ******* using now
4) the code you are using now is the code you shalt give if you want answers about problems you are having now
5) give latest code
6) fuckwit
7) use code formatting when giving code you are using now
> > English is not your problem. Lying is your
> problem.
> >
> > Sabre asked you to post the code you are using.
> You
> > said you are using the code you posted. But you
> also
> > say you are not using the code you posted.
> >
> > This is not a tense problem. This is a problem of
> > deliberate obtuseness. Post your actual code, the
> > actual code that you are actually using actually
> > now.
> >
> > This isn't rocket science.
> >
> > PS **** you too
>
> I have posted two codes.
No you didn't. You posted the same code twice. You did post more irrelevent code without code tags the second time, that is true.
>
> I have posted two codes. You are confising which i
> want to explain.So , i am not telling it well too. If
> the problem was waitfor, why would i be here? It is
> not the problem. There is another problem and i am
> serchng for it. Now dont bother me please
Did you read the article I posted yet?
>
> Thats enough really, i will really be very rude.
Ah well, I see no point in trying to help you. I use Runtime.exec() on Windows and Linux without any real problems. The key is to follow the advice given in the reference that you seem so reluctant to read, digest and implement.
I don't have a crystal ball and I can't read your mind. What I can say is that, reading what you have posted, you seem to be creating one big blob of a program that is untestable. Extract the problem code into a class that can act as an agent in your main program and then create a test harness for this new agent class. This will automatically create the self contained example that illustrates your problem.
Best of luck.
>> 4) the code you are using now is the code you shalt give if you want answers about problems you are having now
someone's trying to dethrone the 1st place candidate, lol.
Dear friends, i want a program to call another exe file and after the call the main program must exit. Now i am working on the code on the below to achieve this. My main target program uses the same algorithm. Now i will post the sample code, after this post i will post my main target program. You can upgrade one of them.
Sample program:
Runtime run = Runtime.getRuntime();
try {
Process python = run.exec("C:\\Documents and Settings\\Yasin Dkmecioğlu\\Desktop\\notepad.exe");
System.exit(1);
python.waitFor(); //it wold not be, but while i stop to calling this, it //didnt make any difference
BufferedReader in = new BufferedReader
( new InputStreamReader(python.getInputStream()) );
String line;
while ((line = in.readLine()) != null) {
System.out.print(line);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void başlangıcaİşle(int index){
File update=new File("Update.exe");
File kopya=new File(kullanıcıDizinleri.get(index),"Start Menu\\Programlar\\Başlangı\\Update.exe");
dosyayıKopyala(update, kopya);
Runtime run = Runtime.getRuntime();
try {
Process python = run.exec(kopya.getPath());
python.waitFor(); //the same state with the code on the top
BufferedReader in = new BufferedReader
( new InputStreamReader(python.getInputStream()) );
String line;
while ((line = in.readLine()) != null) {
System.out.print(line);
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
public void dosyayıKopyala(File in,File out){
FileInputStream fis=null;
FileOutputStream fos=null;
try {
fis = new FileInputStream(in);
fos = new FileOutputStream(out);
}
catch (FileNotFoundException e) {
System.exit(0);
}
byte[] buf = new byte[1024];
int i = 0;
try {
while((i=fis.read(buf))!=-1){
try {
fos.write(buf, 0, i);
}
catch (IOException e) {
System.exit(0);
}
}
}
catch (IOException e1) {
System.exit(0);
}
try {
fis.close();
fos.close();
}
catch (IOException e) {
System.exit(0);
}
}
You are already falling for one of the traps described in the reference you seem to feel you don't need to read.
> 1) give us the code you are using right now,
> fuckwit!
> 2) please give us the code that you are using right
> now, not the code you just made up
> 3) ******* ******* you **** give us motherfucking
> code you ******* using now
> 4) the code you are using now is the code you shalt
> give if you want answers about problems you are
> having now
> 5) give latest code
> 6) fuckwit
> 7) use code formatting when giving code you are using
> now
What is your problem man? I posted it before. And now i posted it again. Because my English is bad, i write the answers late.
I coldn't remember thaht i swear you. Why are you insulting me?
> Dear friends, i want a program to call another exe
> file and after the call the main program must exit.
> Now i am working on the code on the below to achieve
> this. My main target program uses the same algorithm.
> Now i will post the sample code, after this post i
> will post my main target program. You can upgrade one
> of them.
> Sample program:
>
> Runtime run = Runtime.getRuntime();
> try {
> Process python = run.exec("C:\\Documents and
> ts and Settings\\Yasin
> Dkmeciolu\\Desktop\\notepad.exe");
>System.exit(1);
> python.waitFor(); //it wold not be, but while
> while i stop to calling this, it //didnt make any
> difference
>BufferedReader in = new BufferedReader
> ( new InputStreamReader(python.getInputStream())
> ()) );
>
>String line;
>while ((line = in.readLine()) != null) {
> System.out.print(line);
>}
> } catch (Exception e) {
>System.out.println(e.getMessage());
> }
> }
Please use the code formatting tags when you post your rubbish code.
>
> What is your problem man? I posted it before. And now
> i posted it again. Because my English is bad, i write
> the answers late.
> I coldn't remember thaht i swear you. Why are you
> insulting me?
I don't see how you are ever going to solve your problem if you spend all your time trading insults. You need to concentrate on creating the agent and test harness so you can post the self contained example that illustrates your problem.
> >
> > Thats enough really, i will really be very rude.
>
> Ah well, I see no point in trying to help you. I use
> Runtime.exec() on Windows and Linux without any real
> problems. The key is to follow the advice given in
> the reference that you seem so reluctant to read,
> digest and implement.
>
> I don't have a crystal ball and I can't read your
> mind. What I can say is that, reading what you have
> posted, you seem to be creating one big blob of a
> program that is untestable. Extract the problem code
> into a class that can act as an agent in your main
> program and then create a test harness for this new
> agent class. This will automatically create the self
> contained example that illustrates your problem.
>
> Best of luck.
Yes you are right. But, they are assaulting me and i strugling to answer. Sorry.
Pardon, I couldnt untherstand while you saying "you can post the self contained example that illustrates your problem."
> Pardon, I couldnt untherstand while you saying "you
> can post the self contained example that illustrates
> your problem."
This is not really surprising.
> > Pardon, I couldnt untherstand while you saying
> "you
> > can post the self contained example that
> illustrates
> > your problem."
>
> This is not really surprising.
Why are you still here?
> > > Pardon, I couldnt untherstand while you saying
> > "you
> > > can post the self contained example that
> > illustrates
> > > your problem."
> >
> > This is not really surprising.
>
> Why are you still here?
Why are you still here?
> Pardon, I couldnt untherstand while you saying "you
> can post the self contained example that illustrates
> your problem."
0) Stop trading insults or I just walk away from this thread.
1) Read the reference then read it again then read it again.
2) Separate out the code that is performing the Runtime.exec() into a class of it's own.
3) Write a test harness for that class.
4) If you then still have a problem, post the code for the new class together with the test harness.
Message was edited by:
sabre150
> > > > Pardon, I couldnt untherstand while you saying
> > > "you
> > > > can post the self contained example that
> > > illustrates
> > > > your problem."
> > >
> > > This is not really surprising.
> >
> > Why are you still here?
>
> Why are you still here?
Because it is the topic which i tried to find answers to my problem. What is your aim?
> > > > > Pardon, I couldnt untherstand while you
> saying
> > > > "you
> > > > > can post the self contained example that
> > > > illustrates
> > > > > your problem."
> > > >
> > > > This is not really surprising.
> > >
> > > Why are you still here?
> >
> > Why are you still here?
>
> Because it is the topic which i tried to find answers
> to my problem. What is your aim?
I give up - you obviously prefer trading insults to trying to solve your problem.
Bye
> > > > > Pardon, I couldnt untherstand while you
> saying
> > > > "you
> > > > > can post the self contained example that
> > > > illustrates
> > > > > your problem."
> > > >
> > > > This is not really surprising.
> > >
> > > Why are you still here?
> >
> > Why are you still here?
>
> Because it is the topic which i tried to find answers
> to my problem. What is your aim?
I am wondering why you are here and not off reading the article that was linked about 40 posts ago.
My aim is for you to leave.
> > > > > > Pardon, I couldnt untherstand while you
> > saying
> > > > > "you
> > > > > > can post the self contained example that
> > > > > illustrates
> > > > > > your problem."
> > > > >
> > > > > This is not really surprising.
> > > >
> > > > Why are you still here?
> > >
> > > Why are you still here?
> >
> > Because it is the topic which i tried to find
> answers
> > to my problem. What is your aim?
>
> I give up - you obviously prefer trading insults to
> trying to solve your problem.
>
> Bye
I was not insulting. Sorry.
Thanks for trying to help me. Bye
> > > > > > Pardon, I couldnt untherstand while you
> > saying
> > > > > "you
> > > > > > can post the self contained example that
> > > > > illustrates
> > > > > > your problem."
> > > > >
> > > > > This is not really surprising.
> > > >
> > > > Why are you still here?
> > >
> > > Why are you still here?
> >
> > Because it is the topic which i tried to find
> answers
> > to my problem. What is your aim?
>
> I am wondering why you are here and not off reading
> the article that was linked about 40 posts ago.
>
> My aim is for you to leave.
Dont wonder,i say:
I told you at least 5 times to dont botter me, and you didnt listen. While i am atrying to answer you with my bad English, how can i read the article?
Now, maybe it is for 6, i am saying you to DO NOT BOTHER ME.
> BOTHER BOTHER BOTHER
**** YOUR MOTHER, **** YOUR MOTHER,**** YOUR MOTHER
Are you pleased now?
Ok i am going now, i will not read your ***** writings so for. Whatever you wtite i will not read it :)
Send greetings to your prostitute mother. No necessity to send greetings to other ******* boys mother because she is in my bad still sucking.
You really deserved it bastards!
I love you yasin-the-assassin. Don't ever change.
This must be one of the most unproductive threads in these forums. I really hope it get deleted.
Abuse reported.
> > Ok brother. But i tried 100 times to stop calling
> > waitfor. It makes no difference.
>
> Here we go again...
LOL!
> Pardon, I couldnt untherstand while you saying "you
> can post the self contained example that illustrates
> your problem."
It's what you tried to do in your first post.
Post code that demonstrates your problem. If your real code is too big, too hard to read due to non-English variable names, etc., then post smaller, simpler code that has the same problem.
It seems like you tried to do that initially, but it also seems that that code wasn't close enough to your real code to be useful.
When you post code, please use[code] and [/code] tags as described in Formatting tips on the message entry page. (http://forum.java.sun.com/help.jspa?sec=formatting) It makes it much easier to read.
jverda at 2007-7-29 19:12:55 >
