This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Other Languages and the fly likes Convert proc.HasExited from C#.Net to Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "Convert proc.HasExited from C#.Net to Java" Watch "Convert proc.HasExited from C#.Net to Java" New topic
Author

Convert proc.HasExited from C#.Net to Java

kazeopeia joshi
Greenhorn

Joined: Jul 07, 2011
Posts: 12
Hi all,

I have a C#.Net console app code that transfers files between linux and windows ftp servers.

The code's behavior is that I automatically open a console to display status of the file transfer. While transferring files to and from the windows server, I need to display an indicator that the file transfer is on-going (using symbols that look like they are moving or turning) . These symbols are as follows : "|" --> "/" --> "-" --> "\" --> "|"

There had been no problem displaying the said "indicator/symbols" in C#.Net using the following codes :



My problem started when I converted the said codes into java using the following :



Above code is perfectly working.
Problem is I don't know how to display the "animated" characters anymore.
I suddenly don't know (and I badly need help on) how to convert this :



Do you have any idea as to what I can use for the line "if (proc.HasExited)" in java so that I could move forward?

Sorry for the long explanation.
I really, really need help.

Thank you very much in advance!
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19542
    
  16

You can use Process' waitFor method. But before you do, read When Runtime.exec() won't.

I also suggest using ProcessBuilder instead of Runtime.exec to start your Process.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36479
    
  16
Question too difficult for this forum, so I shall move it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Convert proc.HasExited from C#.Net to Java
 
Similar Threads
running a batch file from java
trying to run a linux commands from a java app
PATH ...
accessing java files within folders
How to call Oracle sqlldr in Java