JulioSergio | 6 Sep 01:13
Picon

A simple application that dispatches two desktop applications


I have made a simple application that dispatches any of two desktop
applications, depending on the button depressed. 
The appeareance of the aplication is shown in the figure below:

http://www.nabble.com/file/p19341104/Dispatcher.png 

I simply set as the action of the buttons the following methods:

    private void MandaProceso(String PName) {

        // The Process Name is given as argument: PName. We use it to
        // build up the directory where the jar File is.

        ProcessBuilder pb = new ProcessBuilder();
        Map<String, String> env = pb.environment();

        // First, the value of the environment variable $HOME
        // is found:

        String Home = env.get("HOME");

        // The site for the 'jar' file is:
        String DirName = Home + "/NetBeansProjects/" + PName + "/dist";

        // We establish this as the current directory
        pb.directory(new File(DirName));

        // and the command to be executed is:
        pb.command("java", "-jar", PName + ".jar");

        try {
            Process p = pb.start(); // The process is started.
        } catch (IOException ex) {

Logger.getLogger(DispatcherView.class.getName()).log(Level.SEVERE, null,
ex);
        }
    }

    /**
     * Calls MandaProceso("EditaFOptions"), which dispatches the
     * process java -jar EditaFOptions.jar
     */
    @Action
    public void MandaProcesoFO() {
        MandaProceso("EditaFOptions");
    }

    /**
     * Calls MandaProceso("EditaTema"), which dispatches the
     * process java -jar EditaTema.jar
     */
    @Action
    public void MandaProcesoET() {
        MandaProceso("EditaTema");
    }

Since both processes associated with the buttons were built as Netbeans
projects, I wonder if there is a way to attach 
their "Views" (or Frame Views) to the master Desktop application without the
need of calling them as processes from the 
operating system.

Any advice will be very appreciated,

Sergio.

--

-- 
View this message in context: http://www.nabble.com/A-simple-application-that-dispatches-two-desktop-applications-tp19341104p19341104.html
Sent from the Netbeans - Users mailing list archive at Nabble.com.


Gmane