简体   繁体   中英

Easy way to find import statement for a java package?

I have been using java for a while, and whenever I need to install a package, I generally just look online for an example or guess it. I have looked online for an answer to this question, and am surprised that it is only given in terms of the "name" of the package, the "name" of the subpackage, etc. But where do I find this info? Is there a place I can always look to find the import statement? If not, I am confused about why this is not done as it would be very easy and a huge timesaver.

For example, if I want to import the package "objectlabkit" in java, what is the import statement? I know that the name of the package is objectlabkit, and yet when I type this in followed by a ".", nothing shows up.

Any suggestions?

-Paul

If you use eg Eclipse and if you type in import java. and wait say 1 sec,
then the sub-packages do show up. Just make sure that your package/lib's jar
is on the build classpath of your project ie that Eclipse knows about it.

Then the sub-packages will show up. Also, develop the habit to press Ctrl + [space]
from time to time. And ... if you use another IDE, it will have a similar feature for sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM