// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.IOException;
import java.io.OutputStream;
import java.io.FileOutputStream;

import org.apache.bcel.classfile.ClassParser;
import org.apache.bcel.classfile.JavaClass;
import org.apache.bcel.generic.ClassGen;

public class SetPackage {
    public static void main(String[] args) throws IOException {
        ClassParser pars = new ClassParser("C:\\e\\Util.class");
        JavaClass cls = pars.parse();
        ClassGen cls2 = new ClassGen(cls);
        cls2.setClassName("test.Util");
        OutputStream os = new FileOutputStream("C:\\e\\test\\Util.class");
        os.write(cls2.getJavaClass().getBytes());
        os.close();
    }
}
