You can use ANT to do this task.
Just put ant.jar in classpath.
import java.io.File;
import org.apache.tools.ant.Build
import org.apache.tools.ant.Proje
import org.apache.tools.ant.taskd
import org.apache.tools.ant.types
import org.apache.tools.ant.types
public class JavaCompiler {
public static void compile(String srcDir, String libDir, String destDir) {
Javac javac = new Javac();
Project p = new Project();
javac.setProject(p);
Path srcPath = new Path(javac.getProject());
srcPath.createPathElement(
Path classPath = new Path(javac.getProject());
FileSet fs = new FileSet();
fs.setDir(new File(libDir));
fs.createInclude().setName
classPath.addFileset(fs);
javac.setSrcdir(srcPath);
javac.setDestdir(new File(destDir));
javac.setClasspath(classPa
try {
javac.execute();
} catch (BuildException e) {
System.out.println("Build Exception Raised");
e.printStackTrace();
} catch (Exception e) {
System.out.println("Differ
e.printStackTrace();
}
}
}
-CE
Main Topics
Browse All Topics





by: TimYatesPosted on 2005-04-06 at 04:53:03ID: 13715750
>> I have checked the path and it displays the ref to java dir correctly as well as reference to tool.jar file. All the java commands works fineon the command prompt.
Can you post the classpath?
What command do you use to run the JAR?
Do you have a reference to tools.jar in your jar manifest?
The problem is that tools.jar is not on the classpath...