We present here a novel approach (and its implementation) for the automatic extraction of semantic knowledge from Java libraries. We want to match software libraries, so we need to obtain as much information as possible to use it in the matching process. For this purpose, this approach extracts information about the structure of the classes (i.e., name, fields and hierarchy), as well as information about the behavior of the classes (i.e., methods). In the literature, to our knowledge, it can be only found lightweight approaches to the extraction of this kind of information from Java object code. The approach is implemented in an automatic extraction tool (called Jar2Ontology) that has been developed as a plug-in of the Protégé Ontology and Knowledge Acquisition System. Jar2Ontology extracts the semantics from Java libraries and translates it into OWL (Ontology Web Language).