SamV
SamV

Reputation: 7586

Java / Netbeans cannot find the library / package

I am getting started with this new hardware similar to arduino, called tinkerforge. To actually control any of it (parts havn't arrived yet) in Java you need to include the library within your project.

I create a new library and added the class path, netbeans finds all the files perfectly fine and shows them. (Screenshot) yet it still cannot find any of the classes or the library itself when I use 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?

ps. when I run it i get the java error saying the packages arn't found.

Link to a bigger image: Netbeans Image

Netbeans

Upvotes: 0

Views: 2787

Answers (1)

Jesse Glick
Jesse Glick

Reputation: 25451

I guess you used http://download.tinkerforge.com/bindings/java/tinkerforge_java_bindings_latest.zip which seems to be corrupt. If I add this lib to a project, manually use a FQN:

    com.tinkerforge.BrickletTemperature t = null;

and build with Ant, it produces an error:

.../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. Report to the manufacturer.

Upvotes: 1

Related Questions