Performs the actual compilation.
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;