CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Class Loading

  1. #1
    Join Date
    Jul 1999
    Posts
    1

    Class Loading

    Hi,

    When I am running a Java app and instaniate the obj of class A, in the
    middle of the process, I change the class A and re-compile. How can I make
    the Java app to pick up the new class A without terminate and restart the
    JVM?

    thks, wayne



  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: Class Loading

    I don't think there is any way for this. Actually I'm also looking for something like this.

    But as far as my knowledge is concerned, jvm doesn't read the classes after loading them first time.

    If u find some method for this, I will also be interested!

    - UnicMan
    http://members.tripod.com/unicman

  3. #3
    Join Date
    Apr 1999
    Location
    Bangalore,India
    Posts
    43

    Re: Class Loading

    For this case, you have to write your own classloader which extends the ClassLoader class. In your classloader override the method loadClass(..).

    In the loadClass(..) method, get the class name and read the contents of the class into a byte array by getting a inputstream for the class. After that use the defineClass(..) method to convert your byte array into a Class object and then use that class object to get the new instance.

    I hope this will work but I haven't tried this.
    regards,
    arun...


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured