Processes1 createProcess(String flag) throws Exception {
        String[] jvmoptions = {};
        String work_dir = console.getWork();
        String java_home = Main.java_home();
        String oms_version = Utils.getOMSAppVersion();

        File conf = new File(console.getWork() + File.separatorChar + Console.OMS_DIR, Console.PROJECT_PROPERTIES);
        if (conf.exists()) {
            Properties p = new Properties();
            FileReader fr = new FileReader(conf);
            p.load(fr);
            fr.close();
            String jvmo = p.getProperty(Console.PREF_JAVA_OPTIONS);
            if (jvmo != null) {
                jvmoptions = jvmo.trim().split("\\s+");
            }
            work_dir = p.getProperty(Console.PREF_WORK_DIR, work_dir);
            java_home = p.getProperty(Console.PREF_JAVA_HOME, java_home);
            oms_version = p.getProperty(Console.PREF_OMS_VERSION, oms_version);
        }

//        if (oms_version.compareToIgnoreCase(Utils.getOMSAppVersion()) > 0) {
//            sout.println("This project requires OMS version: '" + oms_version + "', running " + Utils.getOMSAppVersion());
//            return null;
//        }

        if (!new File(java_home).exists()) {
            sout.println("Java home not found: " + java_home);
            return null;
        }

        File oms3Home = Console.getOMSHome(oms_version);
        if (!oms3Home.exists()) {
            sout.println("OMS3 home not found: " + oms3Home);
            return null;
        }

        if (!new File(work_dir).exists()) {
            sout.println("Working directory not found: " + work_dir);
            return null;
        }

        File omsall = new File(oms3Home, Console.jars[0]);
        if (!omsall.exists()) {
            sout.println("Not found: " + omsall);
            return null;
        }


        if (console.getClearOutput()) {
            resetOutput();
        }

        Processes1 p = new Processes1(new File(java_home + File.separator + "bin" + File.separator + "java"));
        p.setWorkingDirectory(new File(work_dir));
        p.setArguments(jvmoptions,
                q + "-Doms3.work=" + console.getWork() + q,
                "-cp", q + Utils.cp_all(oms3Home, console.getWork()) + q,
                "oms3.CLI",
                "-l", getLogLevel(),
                flag, q + file.toString() + q);

        p.redirectOutput(new Writer() {

            @Override
            public void write(char[] cbuf, int off, int len) throws IOException {
                printStdout(new String(cbuf, off, len));
            }

            @Override
            public void flush() throws IOException {
            }

            @Override
            public void close() throws IOException {
            }
        });

        p.redirectError(new Writer() {

            @Override
            public void write(char[] cbuf, int off, int len) throws IOException {
                jTabbedPane1.setSelectedIndex(1);
                jTabbedPane1.setForegroundAt(1, Color.red);
//                jTabbedPane1.setBackgroundAt(1, Color.red);

                printStderr(new String(cbuf, off, len));
            }

            @Override
            public void flush() throws IOException {
            }

            @Override
            public void close() throws IOException {
            }
        });

        return p;
    }