You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Nikolay Chugunov <ni...@googlemail.com> on 2006/10/06 23:25:08 UTC

[general] Dynamic class loading

>From the beginning of learning Java and till now I hate to compile java
source code before run it. I propose to develop easy solution for this
problem: compile java sources on fly.

Command to do it can look like:



java –cp …:mytool.jar
-Djava.system.class.loader=classloader.MyClassLoaderHelloWorld



When executing any application, if MyClassLoader does not find compiled
class in class path, it will try to find file-source of this class with java
extension in class path. If MyClassLoader finds this file, then
MyClassLoader will compile source on fly and load class to MyClassLoader
using *defineClass* method.



The second improvement which I propose to develop is to load jar file from
internet, if user specify URL to jar file in command line.



MyClassLoader may cache compiled classes and loaded jars. MyClassLoader may
use standard and Eclipse compiler to compile sources. Also MyClassLoader may
compile on fly other sources (like Jasmin). The base of my tool will be
existing URLClassLoader in Harmony.


What do you think about my proposals?

Nikolay Chugunov