You are here:

Java/Library Modification

Advertisement


Question
Hi Dear Artemus
I use a library in my java project, i need to change some code of one of classes of that library(i have its source).
Now how i can consider that changes into library?
Thanks in advance,
Sedighe.

Answer
Code in java is loaded by what appears first in the classpath. If you include the jar from your project before the library's jar (and the library isn't sealed) then you can simply include a modified copy of any java files of the library in your project which will be used instead of the one in the library.(you will need to keep the package name and the directory its stored in the same as the library).

If the library is preinstalled on the user's system then you will need to change the package names of the library you want to use. An IDE like Netbeans or Eclipse allows you to easily do this by using Refactor->Rename on the package.

Java

All Answers


Answers by Expert:


Ask Experts

Volunteer


Artemus Harper

Expertise

I have a Masters in computer science. I can answer questions on core J2SE, swing and graphics. Please no questions about JSP or J2ME.

Experience

I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection. Some experience in bio-informatics. Basics in c++ and c#

Organizations
Washington State University

Education/Credentials
MS in Computer Science from Washington State University and a BS in Mathematics and Computer Science from Central Washington University.

©2016 About.com. All rights reserved.