将Jar文件导入eclipse失败 - 无法解析为类型 [英] Import Jar file into eclipse fails - cannot be resolved to a type

查看:548
本文介绍了将Jar文件导入eclipse失败 - 无法解析为类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一些JAR成功导入到我的eclipse java项目中。当我尝试在我的代码中使用JAR文件中的类时,我得到无法解析为类型错误。



现在我必须使用eclipse的自动帮助功能或手动输入import语句来杀死错误并使用这些类。



我如何停止获取错误并删除手动导入所需的时间。
Eclipse从来没有要求我导入Java.Lang.String。那么,我如何确保它对任何其他类做同样的事情?

解决方案

可以使用Eclipse快捷键CTRL + SHIFT + O来组织导入,因此Eclipse将添加必需的导入,以便在类路径中查找所需的类。它可以节省你的时间,它比在一个无法识别的类中使用Ctrl-Space快捷键一个接一个。


I imported some JARs successfully into my eclipse java project. I get "cannot be resolved to a type" error when I try to use the classes in those JAR files in my code.

Now I have to either use eclipse's auto help feature or type the import statements manually to kill the errors and use those classes.

How do i stop getting the errors and remove the need to import manually all the time. Eclipse never asks me to import Java.Lang.String. So, how do i ensure that it does the same thing for any other class ?

解决方案

You can use Eclipse shortcut CTRL+SHIFT+O to "organize imports" so Eclipse will add the import necessary automatically looking for the class needed into the classpath. It can save you time, it is faster than going one by one using Ctrl-Space shortcut on an unrecognized class.

这篇关于将Jar文件导入eclipse失败 - 无法解析为类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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