ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From subir bhaumik <subir...@yahoo.co.in>
Subject Taskdef NullPointerException
Date Thu, 18 May 2006 11:40:31 GMT
Hi
  
     I am trying to execute a simple java code for a build using
      Ant API rather than writing build.xml.When executing the code
  it throws NullPointerException for the line
  
  tinstaller.setClasspath(class_path); 
  
  in the code.
  It is for the class  "org.apache.tools.ant.taskdefs.Taskdef;"
  But for the other taskdefs e.g. Javac its O.K.
  Is there any problem to load classpath in Taskdef object?
  If not then where's the wrong with the code? 
  The Exception
  
  Exception in thread "main" java.lang.NullPointerException
          at org.apache.tools.ant.taskdefs.DefBase.setClasspath(DefBase.java:90)
          at Installer.main(Installer.java:35)
  
  Code
  
  
  
  import org.apache.tools.ant.BuildException;
  import org.apache.tools.ant.launch.Locator;
  import org.apache.tools.ant.taskdefs.Taskdef;
  import org.apache.tools.ant.Project;
  import org.apache.tools.ant.types.Path;
  import com.izforge.izpack.ant.*;
  
  public class Installer  {
     
     public static void main(String args[]) {
              
              Project p = new Project();
              p.init();
              p.setName("Building");
              p.setDefault("installer") ;
              p.setBasedir(".");
              
              
               org.apache.tools.ant.types.Path class_path = new  org.apache.tools.ant.types.Path(p);
            
               class_path.setPath("C:/Bishwakarma/BuildTemp/lib/standalone-compiler.jar");
                         
               org.apache.tools.ant.taskdefs.Taskdef tinstaller = new  org.apache.tools.ant.taskdefs.Taskdef();
              tinstaller.setProject(p);
              tinstaller.setTaskName("izpack");
              
              tinstaller.setClasspath(class_path); 
              
              tinstaller.setClassname("com.izforge.izpack.ant.IzPackTask");
              tinstaller.execute();
              
          }
          
          
      }
  
  Any suggestion will be highly appreciated.
  
  Warm Regards
  Subir
				
---------------------------------
 Why was V. Sehwag warned by the BCCI? Share your knowledge on Yahoo! Answers India
 Send instant messages to your online friends - NOW
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message