ClassLoader not loading recompiled classes
- From: "Aryeh M. Friedman" <Aryeh.Friedman@xxxxxxxxx>
- Date: Tue, 02 Oct 2007 05:53:26 -0000
ClassLoader does not update class on recompile:
Script started on Tue Oct 2 01:45:20 200
cat Main.javapublic class Main
{
public static void main(String[] args)
throws Throwable
{
while(true) {
ClassLoader loader=ClassLoader.getSystemClassLoader();
Class klass=loader.loadClass("MyClass");
MyClass mc=(MyClass) klass.newInstance();
System.out.println("hit any key to reload/rerun MyClass");
System.in.read();
}
}
}
cat MyClass.javapublic class MyClass
{
public MyClass()
{
System.out.println("not hi there");
}
}
javac *.javanot hi there
java Main
hit any key to reload/rerun MyClass
not hi there
hit any key to reload/rerun MyClass
^Z
Suspended
cat foopublic class MyClass
{
public MyClass()
{
System.out.println("foo on you");
}
}
mv foo MyClass.javajava Main
javac MyClass.java
fg
not hi there
hit any key to reload/rerun MyClass
^C
exitScript done on Tue Oct 2 01:47:02 200
.
- Follow-Ups:
- Re: ClassLoader not loading recompiled classes
- From: Daniel Pitts
- Re: ClassLoader not loading recompiled classes
- Prev by Date: Re: Need recommendation for JVM for ARM cpu
- Next by Date: Re: ClassLoader not loading recompiled classes
- Previous by thread: Re: Singly Linked LIst and Objects Newbie Question
- Next by thread: Re: ClassLoader not loading recompiled classes
- Index(es):
Relevant Pages
|