如何在Eclipse中引用的库中使用类 [英] How to use classes in Referenced Libraries in Eclipse

查看:334
本文介绍了如何在Eclipse中引用的库中使用类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经将algs4.jar文件作为引用库导入,如上所示。所有似乎都很好,但我似乎无法使用或访问图书馆中的任何类。



有没有导入语句我缺少? p>

图片参考:





请注意,我试图从引用的库中使用 BinarySearch ,但不提供给我一个选项使用或导入它。

解决方案

我不知道,我没有尝试这个。一些解释虽然如此。



这是一个标准库,还是有人自己创建并给了你?



问题是课程 BinarySearch 默认 。您将无法导入。如果这个库是由你或任何你的朋友创建的,你需要请你的朋友将所有的类从默认包转移到一个好的命名空间,然后重新创建jar。



如果课程可以访问, ctr + shift + o 应该导入课程。


I have imported the algs4.jar file as a referenced library as seen above. All seems to be fine but I can't seem to use or access any of the classes in the library.

Is there an import statement I'm missing?

Image reference:

Note how I'm trying to use BinarySearch from the referenced library but it is not offering me an option to use or import it.

解决方案

I am not sure, I did not try this. Some interpretations though.

Is this a standard library or someone created it by himself and gave you?

The problem is class BinarySearch is in default package. You will not be able to import it. If this library is created by you, or by any of your friend, you need to ask your friend to move all classes from default package to a good namespace and then re-create the jar.

If class is accessible, ctr + shift + o should import the class.

这篇关于如何在Eclipse中引用的库中使用类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆