There is a Java class that unpacks the archives in the directory. If the archive is damaged, the winrar window opens with the contents of "The archive is damaged or has an unknown format." Types of archives zip, rar, arj, 7z.

Tell me how can I hide a pop-up window? Below is a snippet of code

String command = "C:/Program Files/WinRAR/winrar.exe x -ierr -ibck \"" + dir + file.getName() + "\" \"" + dir + "." + file.getName() + "/\""; Runtime rt = Runtime.getRuntime(); Process p = rt.exec(command); try { p.wait(); } catch (Exception e) { // если архив поврежден, то приходит сюда System.out.println("oshibka"); } finally { p.destroy(); } 
  • Running a runtime program using Java from instances of the class Runtime, Process , has no means of controlling its pop-up windows and so on. - java1cprog

1 answer 1

The winrar.exe program has the following command line keys:

-Inul key

Do not display error messages

solution of the problem.