In my programm, I start a gnome-terminal and execute a programm in it. When that programm finished running a simulation, I kill the process and restart it again. Killing it is important because otherwize not all resources are released, even after the simulation stopped (and this makes HeapSpaceError more likely).The method to start the process looks like this:\[code\]private void startNeSSiAndWait(int i) { System.out.println("OS is " + os); // if some unix system - we assume there is a gnome-terminal if(os.contains("nix") || os.contains("nux") || os.contains("aix")){ String[] cmds = {"gnome-terminal", "-x" ,"bash", "-c", "cd '" + nessiPath + "'; export JAVA_HOME="+javaHome +"; ./nessi2.sh"}; try { nessiProcess = Runtime.getRuntime().exec(cmds); // nessiProcess is an instance of Process Thread.sleep(5000); // wait till programm is ready } catch (IOException ex) { System.err.println("Error in executing proces.."); ex.printStackTrace(); }catch(InterruptedException ex){ System.err.println("Error in sleeping.."); ex.printStackTrace(); } }else if(os.contains("win")){ ... }}\[/code\]The method to kill the process is this one:\[code\]private void killNeSSiAndWait(){ nessiProcess.destroy(); try { Thread.sleep(5000); } catch (InterruptedException ex) { System.err.println("Error in sleeping.."); ex.printStackTrace(); } System.out.println("destroyed");}\[/code\]These methods work fine as long as I start it from NetBeans. But as soon as I export it as a Runnable JAR, killing the process doesn't work. I'm running it on Ubuntu 12.10 32Bit machine with Java 6. What might be the reason for it not to work as a Runnable JAR?Edit:
There are no errors as an output. The terminal just continues executing nessi2.sh and ignores the \[code\]nessiProcess.destroy()\[/code\].
There are no errors as an output. The terminal just continues executing nessi2.sh and ignores the \[code\]nessiProcess.destroy()\[/code\].