Writing a Java standard class library alternative from the scratch

classpath, java

Solution

You can use the -Xbootclasspath option to specify your own set of core classes.

If you do go down this path, you will probably end up with a lot of problems if you intend to also use third party libraries as they will depend on the core API and any inconsistencies in your version will likely cause bugs.

As an absolute minimum you'd probably have to reimplement everything in the java.lang package. As well as Object and String, the primitive wrapper classes need to be present in order for auto-boxing to work. I don't think you can replace java.lang without a fair bit of native code to make things like threads work.

Problem

I am just curious but I want to know if it is feasible to remove totally the Java standard class libraries coming with the JVM and start a new one from the scratch [à la ClassPath]. If that is possible, what classes MUST be implemented as minimum? (Object and String come to my mind, but... I do not know). Such thing breaks some license? Is there any way to say to the "java" command to "not use the rt.jar"? Thanks in advance, Ernesto

Original source