简体   繁体   English

已经将jar文件导入了netbeans,但是我的源找不到该库

[英]Already imported the jar files in netbeans but my source cannot find the library

I already imported the jar files in netbeans but my main java file still cannot find the methods. 我已经将jar文件导入到netbeans中,但是我的主要java文件仍然找不到方法。 I am using netbeans 7.3.1 on Mac. 我在Mac上使用的是netbeans 7.3.1。 Does anyone know how make it work? 有谁知道它是如何工作的?

Thank you, 谢谢,

I also had problem with importing classes from imported jar. 我还从导入的jar导入类时遇到问题。 It was so damn annoying... 真是令人讨厌...

There are couple solutions @ web, (clear cache in user's AppData. or make sure to add jar's properly - by using "Add Jar/Folder..." option) but none of them worked for me. @ web有几种解决方案((清除用户AppData中的缓存。或确保正确添加jar-通过使用“添加Jar /文件夹...”选项),但是它们都不适合我。

What worked was new project and importing THE SAME (that's sad) jar files into it. 起作用的是项目,然后将相同(很可惜)的jar文件导入其中。 So I had 2 project with exactly the same contents, but only one of them was working (compiling). 因此,我有2个项目的内容完全相同,但是只有其中一个正在运行(编译)。

EDIT: However, your problem is not related to mine. 编辑:但是,您的问题与我无关。 Root cause of your issue is the jar itself. 您问题的根本原因是罐子本身。

It contains class files in default package that is making them impossible to import . 它包含默认包中的类文件, 这使得它们无法导入

Read here how to import class from default (unnamed) package . 在这里阅读如何从默认(未命名)包中导入类

大家好,只需将您的.jar文件保存在“ C:\\ Program Files \\ Java \\ jdk1.7.0_45 \\ jre \\ lib \\ ext”中,即可使用。我尝试了所有其他选项,但最终我复制了.jar文件在上面的路径,它的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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