You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by paoletto <pa...@gmail.com> on 2008/04/15 20:24:37 UTC

NullPointerException using Javac() from ant API

Hello,
I'm new to ant api. i would like to compile a source from my
application, and i wrote the method below.

When i execute it, i get a NullPointerException at
org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:807)

where it says: File srcDir = getProject().resolveFile(list[i]);
(it's on the last instruction of this snippet, task.execute())

so i guess i screwed up with all the Path stuff..
But how to create and set up a Path object to feed Javac object?
thanks in advance,
Paolo



	public void subsystemCreate(String id, String poolSize) {
	
		String beanName = "BpsAgent"+id;
		String jbossHome =
System.getProperty("jboss.home.dir"+"/"); String serverHome =
System.getProperty("jboss.server.home.dir"+"/"); String tmpDir =
System.getProperty("jboss.server.home.dir")+"/deploy/"+appName+".ear/tmp/src/com/mersy/batch/mdb/";
String appDir =
System.getProperty("jboss.server.home.dir")+"/deploy/"+appName+".ear/";
String src =
System.getProperty("jboss.server.home.dir")+"/deploy/"+appName+".ear/tmp/src/";
String dst =
System.getProperty("jboss.server.home.dir")+"/deploy/"+appName+".ear/tmp/bin/";
System.out.println(beanName); System.out.println(jbossHome);
System.out.println(serverHome); System.out.println(tmpDir);
		System.out.println(appDir);
		System.out.println(src);
		System.out.println(dst);
		
		
		boolean success = (new File(tmpDir)).mkdirs();
	    if (!success) {
	        System.out.println("Megaerrore1");
	        return ;
	    }
	    
		File dstPath=new File(dst);
		success = (dstPath.mkdirs());
	    if (!success) {
	        System.out.println("Megaerrore2");
	        return ;
	    }
	    
	    createMdb(id,poolSize,tmpDir);
	    
	    
		Project project = new Project();
		Path path = new Path(project);
		path.setPath(jbossHome+"/lib/hibernate3.jar;" +
				serverHome+"/lib/ejb3-persistence.jar;"
+ serverHome+"/lib/hibernate-annotations.jar;"+
				serverHome+"/lib/jboss-remoting.jar;"+
				serverHome+"/deploy/ejb3.deployer/jboss-ejb3.jar;"+
				serverHome+"/deploy/ejb3.deployer/jboss-ejb3x.jar;"+
				serverHome+"/deploy/ejb3.deployer/jboss-annotations-ejb3.jar;"+
				appDir+"/locallib/javaee.jar;"+
				appDir+"/locallib/a001llayer.jar;"+
				serverHome+"/lib/log4j.jar");
		
		Path srcPath=new Path(project);
		srcPath.setPath(src);
		

		
		Javac task = new Javac();
		
		task.setSrcdir(srcPath);
		task.setDestdir(dstPath);
		task.setClasspath(path);
		
		task.execute();
-- 
View this message in context: http://www.nabble.com/NullPointerException-using-Javac%28%29-from-ant-API-tp16703622p16703622.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org