0

EDIT: The class I am looking to write is in turn going to be called by a framework. The framework loads my class and asks it to fetch x number of rows from the 'source' - at at time - so it can then pass those x rows down and do stuff with it. The 'source' is a command and I don't see any provisions in the command documentation of batching -so I was thinking i could get the class to basically pause/suspend the command every x rows. Thoughts ???

If I am trying to read the output of a command into a Java program, can I 'pause/suspend' it like I can from the Linux/Unix command line itself? For e.g. if I am running "command-x" and then hit Ctrl-Z, it essentially stops the command, which I can continue later.

Is that possible for me to do when I am reading the output of the program in Java? Or is that something the command has to support?

Thanks in advance!

Bi Act
  • 334
  • 2
  • 3
  • 14
  • Why not just try it? You can always use ctrl+z in the terminal to stop the foreground process. The JVM is no exception. – Chris Martin Dec 11 '14 at 05:48
  • This is a function of the operating system, not of Java. If the operating system supports it, you can do it. – user207421 Dec 11 '14 at 06:34
  • You want to pause the whole program? Or have the program do something other than write output for a time? – Raedwald Dec 11 '14 at 07:55
  • Why do you want to do this? Are you trying to debug your program? See http://stackoverflow.com/questions/25385173/what-is-a-debugger-and-how-can-it-help-me-diagnose-problems – Raedwald Dec 11 '14 at 07:57

1 Answers1

0

You should use breakpoints. Program execution will stop at the breakpoint and you can have a look at the current state of variables, or step through the program line by line.

sdn342323
  • 399
  • 3
  • 5