1

I got a method through which I can perform a checkdisk through Java. Since I am developing a PC optimizer, I need to show the user the indexes completed and the remaining ones.I can do it by running a checkdisk on command line using this:

Runtime.getRuntime().exec

But my concern is how will I get the indexes completed and indexes to be processed on my UI? I will be doing it in Swing.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • 3
    General tip on `exec`. Read (and implement) *all* the recommendations of [When Runtime.exec() won't](http://www.javaworld.com/jw-12-2000/jw-1229-traps.html). That might solve the problem. If not, it should provide more information as to the reason it failed. Then ignore that it refers to `exec` and build the `Process` using a `ProcessBuilder`. Also break a `String arg` into `String[] args` to account for arguments which themselves contain spaces. BTW - The progress might be indicated in the output stream of the running `Process`. – Andrew Thompson Jul 05 '14 at 03:50
  • 2
    I have my concerns about the feasibility of this project. The Checkdisk program requires full access to the disk, which implies that no files should be open and few if any processes being run concurrently. Using a JVM to run it violates both those principles. I would make sure this actually works *without* the UI before you waste too much time building a UI for a program that possibly can never work. – user207421 Jul 05 '14 at 03:56

0 Answers0