Compilation error of simple java files with Google Protocol Buffer
Google protocol buffer/java
I am new to maven and Google Protocol Buffer.
I followed all the README instructions and successfully built the files with Maven.
I got all the files in
protobuf-2.4.1\java\target
(what is the use of this?) The test cases run fine.
I compiled the meta data in the proto file and got the class files generated automatically here:
com\example\tutorial\AddressBookProtos.java
I created two java files: AddPerson.java and ListPeople.java from the code in the tutorial.
I am not able to execute it. Where did I go wrong?
EDIT:
The method mergeFrom(Message) from the type AddressBookProtos.AddressBook.Builder refers to the missing type Message
the second error:
The method writeTo(CodedOutputStream) from 开发者_StackOverflow社区the type AddressBookProtos.AddressBook refers to the missing type CodedOutputStream
These are from the AddPerson.java
AddressBookProtos.java has 100's of errors
Looking at your screen shot it does not look like you have imported the generated classes to your project. Add all generated .java files to the correct location in your src folder and re-try.
You have a compilation error. Hold your cursor over the error in the IDE (Eclipse) and post the error message.
First I don't know anything about this google project but anyways. If its maven try this in the command prompt where your pom.xml is.
mvn eclipse:eclipse
It should generate project files then import the project in eclipse.
精彩评论