1 Reply Latest reply on Jun 8, 2005 5:07 AM by chiba

    why pool.insertClassPath(String) not work?

    nikoused

      hi,I am green head for javassist
      I read the tutorial,but my pool.insertClassPath(String) not work
      why?

      package test;
      import javassist.ClassClassPath;
      import javassist.ClassPool;
      import javassist.CtClass;
      import javassist.CtField;
      
      /*
       * Created on 2005-6-2
       */
      
      /**
       * @author Niko
       */
      public class Test {
       public Test(){
      
       }
       public static void main(String[] args)throws Exception {
       ClassPool pool = ClassPool.getDefault();
       System.out.println(Test.class.getResource("").getPath());
       //pool.insertClassPath(Test.class.getResource("").getPath());
       pool.insertClassPath("D:/Eclipse/workspace/test/bin/test/");
       CtClass cc = pool.makeClass("Rectangle");
       cc.addField(new CtField(CtClass.intType, "userOld", cc));
       cc.writeFile();
       }
      }

      then I think the Rectangle.class file should in dir "D:/Eclipse/workspace/test/bin/test/" or "D:/Eclipse/workspace/test/bin/",but I find in dir "D:/Eclipse/workspace/test/" ?and

      D:\ECLIPSE\WORKSPACE\TEST
      ? .classpath
      ? .project
      ? Rectangle.class
      ?
      ??bin
      ? ??test
      ? Test.class
      ?
      ??src
       ??test
       Test.java


      why?
      thx