Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.ExecuteJava


    }

    /** {@inheritDoc} */
    protected boolean run(Commandline cmd, ProjectComponent log)
        throws BuildException {
        ExecuteJava ej = new ExecuteJava();
        Class c = getN2aClass();
        if (c == null) {
            throw new BuildException("Couldn't load Kaffe's Native2Ascii"
                                     + " class");
        }

        cmd.setExecutable(c.getName());
        ej.setJavaCommand(cmd);
        ej.execute(log.getProject());
        // otherwise ExecuteJava has thrown an exception
        return true;
    }
View Full Code Here


     * @throws BuildException if there is an error.
     * @since Ant 1.6.3
     */
    public boolean compile(Javah javah) throws BuildException {
        Commandline cmd = setupJavahCommand(javah);
        ExecuteJava ej = new ExecuteJava();
        Class c = null;
        try {
            try {
                // first search for the "old" javah class in 1.4.2 tools.jar
                c = Class.forName("com.sun.tools.javah.oldjavah.Main");
            } catch (ClassNotFoundException cnfe) {
                // assume older than 1.4.2 tools.jar
                c = Class.forName("com.sun.tools.javah.Main");
            }
        } catch (ClassNotFoundException ex) {
            throw new BuildException(
                "Can't load javah", ex, javah.getLocation());
        }
        cmd.setExecutable(c.getName());
        ej.setJavaCommand(cmd);
        File f = Locator.getClassSource(c);
        if (f != null) {
            ej.setClasspath(new Path(javah.getProject(), f.getPath()));
        }
        return ej.fork(javah) == 0;
    }
View Full Code Here

     */
    public boolean execute() throws BuildException {
        attributes.log("Using kjc compiler", Project.MSG_VERBOSE);
        Commandline cmd = setupKjcCommand();
        cmd.setExecutable("at.dms.kjc.Main");
        ExecuteJava ej = new ExecuteJava();
        ej.setJavaCommand(cmd);
        return ej.fork(getJavac()) == 0;
    }
View Full Code Here

        // Prepare a command to launch the tool.
        Commandline cmd = setupCommand(javah);
        cmd.setExecutable(clss.getName());

        // Prepare a java command.
        ExecuteJava java = new ExecuteJava();
        java.setJavaCommand(cmd);

        // Find a file or a jar which represents the required class.
        File file = Locator.getClassSource(clss);
        if (file != null) {
            // The found file should be included into the class path.
            Path classpath = new Path(javah.getProject(), file.getPath());

            // Try to load BCEL's ClassPath utility class.
            try {
                clss = Class.forName("org.apache.bcel.util.ClassPath");
            } catch (ClassNotFoundException e) {
                throw new BuildException("Can't load BCEL", e,
                        javah.getLocation());
            }

            // Find a file or a jar which represents the required class.
            file = Locator.getClassSource(clss);
            if (file != null) {
                // Add the found file to the class path.
                classpath.append(new Path(javah.getProject(), file.getPath()));
            }

            // Set the class path.
            java.setClasspath(classpath);
        }

        // Run the java command.
        return java.fork(javah) == 0;
    }
View Full Code Here

        // Prepare a command to launch the tool.
        Commandline cmd = setupCommand(javah);
        cmd.setExecutable(clss.getName());

        // Prepare a java command.
        ExecuteJava java = new ExecuteJava();
        java.setJavaCommand(cmd);

        // Find a file or a jar which represents the required class.
        File file = Locator.getClassSource(clss);
        if (file != null) {
            // The found file should be included into the class path.
            Path classpath = new Path(javah.getProject(), file.getPath());

            // Try to load BCEL's ClassPath utility class.
            try {
                clss = Class.forName("org.apache.bcel.util.ClassPath");
            } catch (ClassNotFoundException e) {
                throw new BuildException("Can't load BCEL", e,
                        javah.getLocation());
            }

            // Find a file or a jar which represents the required class.
            file = Locator.getClassSource(clss);
            if (file != null) {
                // Add the found file to the class path.
                classpath.append(new Path(javah.getProject(), file.getPath()));
            }

            // Set the class path.
            java.setClasspath(classpath);
        }

        // Run the java command.
        return java.fork(javah) == 0;
    }
View Full Code Here

      command.createArgument().setValue(sei);
     
      if (verbose)
         log("Command invoked: " + command.getJavaCommand().toString());
     
      ExecuteJava execute = new ExecuteJava();
      execute.setClasspath(path);
      execute.setJavaCommand(command.getJavaCommand());
      if (execute.fork(this) != 0)
         throw new BuildException("Could not invoke WSProvideTask", getLocation());
   }
View Full Code Here

      log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
     
      if (verbose)
         log("Command invoked: " + command.getJavaCommand().toString());

      ExecuteJava execute = new ExecuteJava();
      execute.setClasspath(path);
      execute.setJavaCommand(command.getJavaCommand());
      if (execute.fork(this) != 0)
         throw new BuildException("Could not invoke WSConsumeTask", getLocation());
   }
View Full Code Here

      log("Consuming wsdl: " + wsdl, Project.MSG_INFO);
     
      if (verbose)
         log("Command invoked: " + command.getJavaCommand().toString());

      ExecuteJava execute = new ExecuteJava();
      execute.setClasspath(path);
      execute.setJavaCommand(command.getJavaCommand());
      if (execute.fork(this) != 0)
         throw new BuildException("Could not invoke WSConsumeTask", getLocation());
   }
View Full Code Here

      command.createArgument().setValue(sei);
     
      if (verbose)
         log("Command invoked: " + command.getJavaCommand().toString());
     
      ExecuteJava execute = new ExecuteJava();
      execute.setClasspath(path);
      execute.setJavaCommand(command.getJavaCommand());
     
      if (execute.fork(this) != 0)
         throw new BuildException("Could not invoke WSProvideTask", getLocation());
   }
View Full Code Here

      command.createArgument().setValue(sei);
     
      if (verbose)
         log("Command invoked: " + command.getJavaCommand().toString());
     
      ExecuteJava execute = new ExecuteJava();
      execute.setClasspath(path);
      execute.setJavaCommand(command.getJavaCommand());
     
      if (execute.fork(this) != 0)
         throw new BuildException("Could not invoke WSProvideTask", getLocation());
   }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.ExecuteJava

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.