Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to import a jar file into eclipse as a project to use source code of classes of that jar.

 
Mani Raju
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have one jar file. I want to see the source code of classes of this jar file and i need to use source code of this jar file. Is there any option to view and use that jar file source code?
Is there any option in eclipse to extract jar file and to see the source code of that jar file?

 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the source code available at all?
 
Mani Raju
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ivan Jozsef Balazs wrote:Is the source code available at all?



I dont have source code, is there any possibility to see the source code of classes present in that jar file in eclipse?

 
Ivan Jozsef Balazs
Rancher
Posts: 979
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A jar files typically contains class files and other resources, typically no sources, albeit it is not unconceivable.

The class files do not contain every information the sources do. For example local variable and parameter names will be missing. Neither Eclipse nor other tool will be able to recover them if these pieces of information are missing. The method names and parameter types are of course visible.
 
Mani Raju
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, i tried to add plug in eclipse but i am getting error by selecting "Help-->Install new software". The error is "Can not complete the request : The installation not configured properly for software updates. See the error log file for details."
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What plugin did you try to install? The log file mentioned is at workspace/.metadata/.log, look in there for additional details.

Usually you don't need the source to access classes and their methods that are packaged into a JAR. All you really need to do is add the JAR to the build path of your project. Eclipse will then let you browse through the classes in the jar and view all public fields and methods.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic