So I am trying to catch (NumberFormatException ex) in my code:
private void Processes() throws IOException, InterruptedException { // New Thread "processesThread" will start here. final Object mon = threadBlock; Thread processesThread = new Thread(new Runnable() { @Override public void run() { synchronized (mon) { try { try { try { Runtime rt = Runtime.getRuntime(); // "runnableTogether" will be the number that the user inputs in the GUI. switch (runnableTogether) { case 4: processes.add(rt.exec("C:/Windows/System32/SoundRecorder.exe")); case 3: processes.add(rt.exec("C:/Windows/System32/taskmgr.exe")); case 2: processes.add(rt.exec("C:/Windows/System32/notepad.exe")); case 1: processes.add(rt.exec("C:/Windows/System32/calc.exe")); Thread.sleep(5000); destroyProcesses(processes); break; default: invalidInput(); break; } mon.wait(); } catch (IOException ex) { } } catch (InterruptedException ex) { } } catch (NumberFormatException ex) { nullInput(); } } } }); But it gives me this error:
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:504) at java.lang.Integer.parseInt(Integer.java:527) at tf2_account_chief.TF2_Account_Chief.actionPerformed(TF2_Account_Chief.java:425) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018) at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341) at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) at java.awt.Component.processMouseEvent(Component.java:6505) at javax.swing.JComponent.processMouseEvent(JComponent.java:3321) What am I doing wrong here? Any ideas?
UPDATE: Here is the PasteBin link for the full code!