The CLASSPATH is basically an environment variable passed to the javac Java compiler using the command line argument -cp
javac -cp %CLASSPATH% ... someclass.java
The system classloader however can be accessed at runtime and paths can be added via reflection on the protected method addURL(url) on an instance of URLClassLoader. This is definitely a hack and reflects on an implementation detail but it works successfully on Suns JVM.
A singleton class that encapsulates a _path attribute and holds an ClassLoader.getSystemClassLoader() ClassLoader instance that will be updated when a path is appended.
Appends a path to the classpath applying ClassLoader.getSystemClassLoader().addURL(...).
The path parameter is expected to be a normal file system path. It will be converted into an URL path using Pythons urllib.
The representation of the ClassPath object is a string representation of the Java classpath using the particular classpath separator of the operating system.
A new sys.classpath attribute is introduced. Its value has type ClassPath.
Notice that updating sys.classpath causes an equal update on sys.path. This update was synchronized after I realized that I did this manually in every single case.
If an application creates an own ClassLoader the sys.classpath information might get lost. This is not the case for the JavaCompiler defined in jcompile which explicitely uses sys.classpath.