Link to home
Start Free TrialLog in
Avatar of HLRosenberger
HLRosenbergerFlag for United States of America

asked on

How to find what library a specific function/method is in..

How does one go about finding the location of a specific function/method?   In other words, how does one know what libraries to import?
Avatar of Venabili
Venabili
Flag of Bulgaria image

You find which class the method is into and then import this class...

Or do you mean how you find which jars you need? If so -depends on the types of library. For the public ones, I am kinda used to the ones that I use... and internet help on the rest. For private one, I just search inside of the jars to find where the class is.

Or do you ask about something else?
Avatar of mrcoffee365
This can be a weirdly hard question to answer.  I often google for the missing class, because some kind soul has put the api on the Web somewhere.  In checking, I just found this tool:
http://www.jarfinder.com/

which worked well with the sample class I tried.

There is a jwhich utility which will tell you where your class is in a defined classpath.  That needs the command line set up with a classpath.  This Java World article talks about it:
http://www.javaworld.com/javaworld/javatips/jw-javatip105.html
Avatar of HLRosenberger

ASKER

mrcoffee365:

You have understood my question.  And, that's what I do - google it!  But that's a pain, and not a real good solution.  It seems to me that there should be something built into the IDE.
Can a NetBeans expert tell me if this kind of functionality is built into the IE?  

For example, suppose I want to use JOptionPane.   Seems to me that the IDE should be able to tell me that I have to  import  javax.swing.JOptionPane.

Otherwise, I have to google it or otherwise know what to import.
Hold on - are you talking about classes or about finding which jar file the class is into?
All the IDEs will tell you that you have to import javax.swing.JOptionPane.  So NetBeans should tell you that, and Eclipse does.  What they can't tell you is the name of the jar.  Unless you have already added the jar to the project classpath.

So I use jwhich or google to find a jar if I can't figure it out on my own.
ASKER CERTIFIED SOLUTION
Avatar of Venabili
Venabili
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ctrl-Shift-I.

That's exactly the type of thing I'm looking for!  Thanks!
JUst copying the grading comment as it is not visible for everyone:
Author Comments:
Ctrl-Shift-I.

That's exactly the type of thing I'm looking for! Thanks!
======end of grading comment=====

You are welcome  :)  If you are not familiar with the shortcuts http://netbeanside61.blogspot.com/2008/04/top-10-netbeans-ide-keyboard-shortcuts.html has a list of the most useful ones :)