473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

custom class loader question

Hi

I've written a Custom class loader, which reads the bytecode from a
database and returns the Class object.

For example, bytecode of a class "Test" is stored in the database.
Through custom class loader, I get the Class object for this class
"Test" as follows:

Class c = cl.loadClass("Test",true)) // cl is instance of my custom
class loader

Now I want to call the methods of "Test" class.
Is it possible to get an instance of the Test class?

One way to access the methods of the Test object is using reflection
APIs, but is there a way I can directly get the instance of Test
class, which I can use to call its methods.

thanks,
Naresh
Jul 17 '05 #1
1 4283
Naresh Agarwal wrote:
Hi

I've written a Custom class loader, which reads the bytecode from a
database and returns the Class object.

For example, bytecode of a class "Test" is stored in the database.
Through custom class loader, I get the Class object for this class
"Test" as follows:

Class c = cl.loadClass("Test",true)) // cl is instance of my custom
class loader

Now I want to call the methods of "Test" class.
Is it possible to get an instance of the Test class?
Use Class.newInstance().

One way to access the methods of the Test object is using reflection
APIs, but is there a way I can directly get the instance of Test
class, which I can use to call its methods.


Yes, this should be possible, but will require some configuration and/or
special code. I believe there is a way to tell the JVM which class
should be the system class loader. I would start there.

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Murat Tasan | last post by:
hi, i am having a small problem with constructing an inner class. i am using an inner class (and not a static nested class) because the methods of the inner class need access to the enclosing...
1
by: Tony Burrows | last post by:
I need to be able to load different classes at different times. The problem is that these classes may have the same name. Is there any way to unload a class at runtime so that it can be replaced...
0
by: Ted Miller | last post by:
Hi folks, I originally posted this on microsoft.public.dotnet.framework.interop. Reposting to broaden the audience. I'm having an interop problem where my managed component is reentered from...
8
by: Tinus | last post by:
Hello all, I've create a custom control (UserControl) and have a custom Item Collection. The control is a custom calendar which is draw using the Graphics Rectangle etc. functions. It is drawn...
2
by: BentleyInc | last post by:
I wrote a DownloadRequestHandler to be used in http://server/DownloadDir and I've made the correct IIS settings for DownloadDir. Currently I'm having problem loading up some dependent assemblies....
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
6
by: Mark Wilden | last post by:
Take a class, RateTableProductCode. It needs to share implementation with other classes, so the common code is placed in a ProductCode class, from which it derives. There needs to be an...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
0
by: Ravi Kumar | last post by:
hi :) I was trying to develop a custom mod_python based web-site, just today. the problem I got though i liked the mod_python's feature of mapping and calling functions in python script by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.