I'm trying to change some classes from open jdk, so I'm creating the same package structure as the open jdk classes have and I'm changing the classes using netbeans. When i'm building the project if something is wrong in the overwritten classes i'm getting an error. If a successfully build my project it seems like the changes from my classes are not considered by the application, the open jdk classes are used instead. Any idea how can I use my classes and not the ones from openjdk ?
Example:
if i create the class sun.net.www.protocol.https.HttpsURLConnectionImpl in my project and I do some changes in it, I build the project, but when I run he application my changes do not appear, like the original class from openjdk is used, not my class.
you need to change the bootstrap classpath java -X for more info, here is just the option you need exactly.
-Xbootclasspath/p:
And good luck hacking the source!!
This is what the extension classes is intended for.
See http://download.oracle.com/javase/1.5.0/docs/tooldocs/findingclasses.html#javalauncher for details. Basicall you either drop jars in the ext folder, or indicate with system properties what you want in front of the classpath overriding standard Java classes.
You should create your class in your own package and have the application that uses this class import your class instead. So you can create a class called HttpsURLConnectionImpl in package com.yourdomain.
Then in the application code make sure that you import:
import com.yourdomain.HttpsURLConnectionImpl;
Then in your code your own class will be used.
If there is anybody who has a problem with using -Xbootclasspath option I absolutely recommend the following page I have found some time ago:
https://github.com/adrianmalik/hotspot-overriding-jdk .
There is a detailed explanation how to use this option with a good (and working) code sample.