Javassist использует файл jar

Как добавить файл jar в путь поиска для javassist и заставить его работать правильно? Я пытаюсь изменить файл jar, не распаковывая, а затем перезагружая.

import javassist.*;

class Injector
{

  public static void main(String[] argv) throws Exception
  {
    // Load the class representation
    ClassPool pool = ClassPool.getDefault();
    pool.insertClassPath( "myjarfile.jar" ); 
    CtClass cc = pool.get("org.mine.Myclass"); ////////// Not reading Myclass from myjarfile.jar


    // Find the method we want to patch and rename it 
    // (we will be creating a new method with the original name).
    CtMethod m_old = cc.getDeclaredMethod("methodToRename");
    // m_old.setName( "methodToRename" );

    cc.removeMethod( m_old );


  }
}

person BAR    schedule 25.05.2013    source источник


Ответы (1)


Решил просто:

pool.insertClassPath( "/Path/from/root/myjarfile.jar" );
person BAR    schedule 25.05.2013