|
From: Samuele P. <ped...@bl...> - 2002-01-28 16:16:56
|
Have you tried that. Has he tried that? I have tried with: 1) java version "1.3.0" Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C) Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode) 2) java version "1.1.7A" 3) Caricatore riga comandi Microsoft (R) per Java Versione 5.00.3802 Copyright (C) Microsoft Corp 1996-2000. Tutti i diritti riservati. (It's jview, Versione is version) Funny, Funny. (To be honest I didn't need to try, jview not with standing) regards, Samuele Pedroni. ----- Original Message ----- From: Updike, Clark <Cla...@jh...> To: <jyt...@li...> Sent: Monday, January 28, 2002 4:15 PM Subject: [Jython-dev] jreload--it IS possible to reload a class in the same classloader > regarding http://www.jython.org/docs/jreload.html and the statement: > > "Why there is no support for reloading a single class? Java classes are > loaded through class-loaders, actually there is no support in java to > redefine an already loaded class through its class-loader." > > I don't mean to split hairs here, but it IS actually possible to redefine an > already-loaded class in the same classloader as long as you use Class > methods to load it. i.e. > use: > > Class redefineable = Class.forName("MyRedefinealbeClass"); > redefineable.newInstance(); > > // Assume the previous version of MyRedefineableClass.class was modified > // Reload the new one... > redefineable = null; > System.gc(); > Class redefineable = Class.forName("MyRedefineableClass"); > redefineable.newInstance(); > > Instead of: > > MyUNRedefinableClass unRedefineable = new MyUNRedefineableClass(); > murdc = null; > > // does NOT pick up any changes to MyRedefineableClass.class > unRedefineable = new MyUNRedefineableClass(); > > > This functionality is described in the following article, > http://www.sys-con.com/java/articleprint.cfm?id=307 > > I don't know if this adds any new possibilities for jreload or not (or if > I'm wrong), but thought it worth pointing out anyway. Note that the article > makes a call to System.gc() to "force" the classloader to dump the current > version but I don't believe System.gc() guarantees that this will happen. > > -Clark > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-dev > |