public String buildCommand(){
        StringBuffer vmArgsOneLine = new StringBuffer();
        for (String arg : vmArgs) {
            // if it's the agent argument : we ignore it otherwise the
            // address of the old application and the new one will be in conflict
            if (!arg.contains("-agentlib")) {
                vmArgsOneLine.append(arg);
                vmArgsOneLine.append(" ");
            }
        }
        final StringBuffer cmd = new StringBuffer("" + javaBin + " " + vmArgsOneLine);

        String[] cmdArgs = execCmd.split(" ");
        if(cmdArgs[0].endsWith(".jar")) cmd.append("-jar " + new File(cmdArgs[0]).getPath());
        else                            cmd.append("-cp \"" + System.getProperty("java.class.path") + "\" " + cmdArgs[0]);

        for (int i = 1; i < cmdArgs.length; i++) {
            cmd.append(" ").append(cmdArgs[i]);
        }

        for(String arg : addArgs){
            cmd.append(" ").append(arg);
        }
        
        this.finalCommand=cmd.toString();
        Commons.log.info("[Restarter] Generated restart command: "+finalCommand);
        return finalCommand;
    }