You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-user@jakarta.apache.org by gaurav shankar <sh...@hotmail.com> on 2003/04/01 04:46:06 UTC

Re: class to JavaClass file

What I am trying to do is change in constant pool of every class my 
application loads (not all but that also includes some library classes ) for 
that im trying to change instance of Class that findSystemClass() returns 
into that of JavaClass so that I can change in the constant pool and then 
use defineClass on it. ClassParser converts DataInputStream into JavaClass, 
how can I make it to change Class into JavaClass.

Thanks
Gaurav Shankar
CS Deptt , Rutgers University






>From: "Juozas Baliuka" <ba...@mwm.lt>
>Reply-To: "BCEL Users List" <bc...@jakarta.apache.org>
>To: "BCEL Users List" <bc...@jakarta.apache.org>
>Subject: Re: class to JavaClass file
>Date: Mon, 31 Mar 2003 17:25:44 +0200
>
>
>Sometimes it can work on system classes too,
>classloader can not define system class, but you can try depricated
>"defineClass(byte[] b, int pos, int len)" method, I am not sure this will
>work for classes like Object or String,
>and it is no way to define classes for arrays.
>
>
> > Hi,
> > Im trying my class loader with BCEL, Im looking Constant pool of each
>class
> > used by my application, even system classes, for that I need to convert
> > class file ( which I get as result of findSystemClass() ) and convert it
>to
> > JavaClass file.
> >
> >
> > regards
> >
> > Gaurav Shankar
> >
> > _________________________________________________________________
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: bcel-user-help@jakarta.apache.org
> >
> >
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>


_________________________________________________________________



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


Re: class to JavaClass file

Posted by Juozas Baliuka <ba...@centras.lt>.
You can load class file as resource with system classloader, but you can not
to define it twice in the same classloader:

 JavaClass jclass =  new
ClassParser(Object.class.getResource(Object.class.getName().replace('.','/')
+ ".class")),Object.class.getName());


> What I am trying to do is change in constant pool of every class my
> application loads (not all but that also includes some library classes )
for
> that im trying to change instance of Class that findSystemClass() returns
> into that of JavaClass so that I can change in the constant pool and then
> use defineClass on it. ClassParser converts DataInputStream into
JavaClass,
> how can I make it to change Class into JavaClass.
>
> Thanks
> Gaurav Shankar
> CS Deptt , Rutgers University
>
>
>
>
>
>
> >From: "Juozas Baliuka" <ba...@mwm.lt>
> >Reply-To: "BCEL Users List" <bc...@jakarta.apache.org>
> >To: "BCEL Users List" <bc...@jakarta.apache.org>
> >Subject: Re: class to JavaClass file
> >Date: Mon, 31 Mar 2003 17:25:44 +0200
> >
> >
> >Sometimes it can work on system classes too,
> >classloader can not define system class, but you can try depricated
> >"defineClass(byte[] b, int pos, int len)" method, I am not sure this will
> >work for classes like Object or String,
> >and it is no way to define classes for arrays.
> >
> >
> > > Hi,
> > > Im trying my class loader with BCEL, Im looking Constant pool of each
> >class
> > > used by my application, even system classes, for that I need to
convert
> > > class file ( which I get as result of findSystemClass() ) and convert
it
> >to
> > > JavaClass file.
> > >
> > >
> > > regards
> > >
> > > Gaurav Shankar
> > >
> > > _________________________________________________________________
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: bcel-user-help@jakarta.apache.org
> > >
> > >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: bcel-user-help@jakarta.apache.org
> >
>
>
> _________________________________________________________________
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: bcel-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: bcel-user-help@jakarta.apache.org
>


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