ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paolo <pa...@wci.ath.cx>
Subject NullPointerException with ant Javac() api
Date Tue, 15 Apr 2008 15:35:19 GMT
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();




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


Mime
View raw message