2

I am trying to enhance a library. The library is in the Referenced folder of eclipse. I presume in that folder I can't just edit the code so I guess I have to import the whole .jar file as kind of a project, but how can I do it in eclipse .....

Fendrix
  • 556
  • 2
  • 11
  • 34
  • 2
    If you are unable to get access to the code, the only "enhancements" you can make to a library is to create subclasses or wrapper classes. This is no different than creating your own project which uses the library. – Code-Apprentice Jan 14 '13 at 18:27
  • I actually wanted just to add the classes which I created in my Project to the lib... but I found a class in the library I really wanted to edit... u re probably right of using the wrapping... – Fendrix Jan 14 '13 at 18:37
  • 1
    Depending on the library's licensing, you may be able to repackage it with your additional classes. This is most commonly available with open source, so you would want to download the source code and/or fork the official source code repository. – Code-Apprentice Jan 14 '13 at 19:12

2 Answers2

5

The right way to do it is to find/download the source code for the library. The ugly way to do it is to decompile the library.

After that, edit the source code, and run against your custom version.

Community
  • 1
  • 1
Matt Ball
  • 354,903
  • 100
  • 647
  • 710
2

You probably need some sort of Java code decompiler to get the source code for that library and then make an eclipse project based on its source. It will be tedious and you will need to setup the dependencies and all that. However you might want to see if the source for that project is already somewhere on internet, eg open source libraries. One better approach could also be extending that library by means of extending classes and that.

Farzad
  • 1,132
  • 9
  • 21