I'm using Archlinux with both Thrift 0.9.3 and Apache installed. In my Netbeans project, when I import org.apache.thrift.*;
I got "package org.apache.thrift does not exist". This answer didn't solved the problem because I got not /lib/java
folder neither the other answer. Until the moment I couldn't find an answer on the internet. Thanks in advance.
You need the libthrift
JAR file in order to use java code generated by the Thrift compiler.
If your project is set up to be able to use Maven repositories, you can add this artifact to your project:
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.3</version>
</dependency>
Alternatively you could just download the JAR file from Maven central and add it to your project:
http://central.maven.org/maven2/org/apache/thrift/libthrift/0.9.3/libthrift-0.9.3.jar
Also important to note is that the version of the JAR you use should match the version of the Thrift compiler that you use for code generation; so if you upgrade the Thrift compiler used for your project, you should upgrade the version of the JAR file as well.