已安装Apache和Thrift但Netbeans无法看到导入org.apache.thrift(Apache and Thrift installed but Netbeans can't

系统教程 行业动态 更新时间:2024-06-14 16:57:18
已安装Apache和Thrift但Netbeans无法看到导入org.apache.thrift(Apache and Thrift installed but Netbeans can't see import org.apache.thrift)

我正在使用Archlinux同时安装了Thrift 0.9.3和Apache。 在我的Netbeans项目中,当我import org.apache.thrift.*; 我得到“包org.apache.thrift不存在” 。 这个答案并没有解决问题,因为我没有/lib/java文件夹,也没有其他答案。 直到我无法在互联网上找到答案。 提前致谢。

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.

最满意答案

您需要libthrift JAR文件才能使用Thrift编译器生成的Java代码。

如果您的项目设置为能够使用Maven存储库,则可以将此工件添加到项目中:

<dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId> <version>0.9.3</version> </dependency>

或者,您可以从Maven central下载JAR文件并将其添加到您的项目中:

http://central.maven.org/maven2/org/apache/thrift/libthrift/0.9.3/libthrift-0.9.3.jar

另外需要注意的是,您使用的JAR版本应该与您用于代码生成的Thrift编译器的版本相匹配; 因此,如果升级用于项目的Thrift编译器,则还应升级JAR文件的版本。

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.

更多推荐

本文发布于:2023-04-12 20:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/e7dbdf228b4ed780cd5fbe2c84562b57.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Netbeans   org   Apache   Thrift   installed

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!