Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 为什么在google protobuf中缺少ProtocolStringList时会出现错误?_Java_Protoc - Fatal编程技术网

Java 为什么在google protobuf中缺少ProtocolStringList时会出现错误?

Java 为什么在google protobuf中缺少ProtocolStringList时会出现错误?,java,protoc,Java,Protoc,我遇到了一个问题,对ProtocolStringList的引用在protoc创建的生成代码中导致了一个类notfound错误 在这种情况下,我得到了一个Eclipse错误: com.google.protobuf.ProtocolStringList cannot be resolved to a type 我希望它也能表现为: java.lang.NoClassDefFoundError: com/google/protobuf/ProtocolStringList 我在堆栈溢出上找不到这

我遇到了一个问题,对
ProtocolStringList
的引用在protoc创建的生成代码中导致了一个类notfound错误

在这种情况下,我得到了一个Eclipse错误:

com.google.protobuf.ProtocolStringList cannot be resolved to a type
我希望它也能表现为:

java.lang.NoClassDefFoundError: com/google/protobuf/ProtocolStringList

我在堆栈溢出上找不到这个问题的答案,所以我将它发布在这里


事实证明,这是由于使用了较新版本的
protoc
(本例中为2.6.1)和较旧版本的
protobuf java*.jar
。(本例中为2.5.0)。

您能详细说明一下吗?那么你是怎么解决这个问题的呢?是升级还是降级?@ThariqNugrohotomo是的。只要确保jar和protoc的版本相同,就可以向任意方向移动,只要您使用与jar相同的版本运行protoc,然后运行代码。