Is there a way to unjar and have java classes as it is in eclipse and add log statements to it and jar it again

If yes how do we get java source from it and add couple of logs to it and jar it again
cutie_smilyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kevin CrossChief Technology OfficerCommented:
Do you have the .java files in the JAR?  JAR files are archives, so you can usually open them up using your zip program like WinZIP.  If the JAR contains the .java files themselves then you can just import in Eclipse and choose the JAR as source then repackage a JAR.  

What you will most likely want / have to do though is to inherit from a class in the JAR, making a custom version in which you add some more logging, then in your code you call your custom class instead of the original one.
0
a_bCommented:
What you can do is to unzip the jar file. If the jar contains *.class files, used JAD - Java decompiler to convert it into code. I have my doubts if you can add code to the class file and jar it again.

Have a look at the following link - http://sourceforge.net/projects/jadclipse/

0
cutie_smilyAuthor Commented:
I do not have java files . But i unzipped jar and decompiled class files to get java source. But the source has errors. like  unresolved errors (not finding classes). Will it jar if i just add logs to it and jar using eclipse. Please suggest me any ideas
0
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

a_bCommented:
The unresolved errors can be done away with if you can get a hold of the libraries/classes being referred to in the jar code. After you decompile and get the source and add the libraries/classes and the log files you will have to recompile the files and build the jar for it to work correctly.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cutie_smilyAuthor Commented:
well their code depends on different jars where i don't e acess to it ..may be they added to their build path. ow to get hoded for build path not sure
0
a_bCommented:
If you cannot compile their code, you will not be able to build the jar again.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.