Reputation: 166
Can I modify src.zip(it contains java classes predefined ) so that i
first unzip and then add my personal package and zip and replace the src.zip with this new src.zip i modified.
so that i can import them just like any other classes.
Upvotes: 0
Views: 1035
Reputation: 11487
src.zip
folder will not be included in java classpath, yes you can add your own classes in it. But in order to add it your classpath ,it needs to be compiled and the resulting class files you can add use.
But its not recommended to modify jdk source, unless you know exactly what you are trying to do.
Upvotes: 0
Reputation: 272357
Check out the Java tutorial on the CLASSPATH. That provides an extensible means of adding libraries for Java usage which doesn't impact the original install, and can be segregated between running processes.
The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes. (Classes that are part of the JRE, JDK platform, and extensions should be defined through other means, such as the bootstrap class path or the extensions directory.)
The preferred way to specify the class path is by using the -cp command line switch. This allows the CLASSPATH to be set individually for each application without affecting other applications
You'll rarely have to touch the JDK/JRE install, and I would strongly recommend against it. By using mechanisms such as the above, each app can specify its own libs, and you can swap between variants of the JDK/JRE without having to ensure each deployment is modified.
Upvotes: 2
Reputation: 10161
What you want is set the classpath.
Of cause, you can add your classes to the rt.jar file, but I highly recommend not to do so.
Upvotes: 0
Reputation: 1073
The src.zip contains the source files not the class files and it won't be part of the built in classpath either.
If you have to import your classes, you have to keep you other dependent jars in the classpath.
Upvotes: 1