简体   繁体   English

Java / Netbeans找不到库/包

[英]Java / Netbeans cannot find the library / package

I am getting started with this new hardware similar to arduino, called tinkerforge. 我正在开始使用这种类似于arduino的新硬件,称为tinkerforge。 To actually control any of it (parts havn't arrived yet) in Java you need to include the library within your project. 要在Java中实际控制其中的任何一个(部分尚未到达),您需要在项目中包括该库。

I create a new library and added the class path, netbeans finds all the files perfectly fine and shows them. 我创建了一个新的库并添加了类路径,netbeans可以找到所有文件并很好地显示它们。 (Screenshot) yet it still cannot find any of the classes or the library itself when I use import. (屏幕截图)但是当我使用import时,它仍然找不到任何类或库本身。

I spent 4 hours trying to figure out whats wrong and have gotten nowhere. 我花了四个小时试图找出问题所在,却一无所获。 I don't usually come to have my problems solved :/ I'm new to java though so I might be missing something? 我通常不会解决我的问题://尽管我是Java新手,所以我可能会缺少一些东西?

ps. ps。 when I run it i get the java error saying the packages arn't found. 当我运行它时,出现Java错误,提示找不到软件包。

Link to a bigger image: Netbeans Image 链接到大图: Netbeans图片

网豆

I guess you used http://download.tinkerforge.com/bindings/java/tinkerforge_java_bindings_latest.zip which seems to be corrupt. 我猜您使用了似乎已损坏的http://download.tinkerforge.com/bindings/java/tinkerforge_java_bindings_latest.zip If I add this lib to a project, manually use a FQN: 如果我将此库添加到项目中,请手动使用FQN:

    com.tinkerforge.BrickletTemperature t = null;

and build with Ant, it produces an error: 并使用Ant构建,会产生错误:

.../src/....java:4: error: cannot access BrickletTemperature
        com.tinkerforge.BrickletTemperature t = null;
  bad class file: /tmp/Tinkerforge.jar(com/tinkerforge/BrickletTemperature.class)
    class file contains wrong class: bindings.BrickletTemperature
    Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error

javap confirms that the classes are not in the declared package. javap确认类不在声明的包中。 Report to the manufacturer. 向制造商报告。

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

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