user244333
user244333

Reputation:

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.

eclipse screenshot

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 the type AddressBookProtos.AddressBook refers to the missing type CodedOutputStream

These are from the AddPerson.java

AddressBookProtos.java has 100's of errors

Upvotes: 1

Views: 1537

Answers (3)

jontro
jontro

Reputation: 10628

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.

Upvotes: 1

user425367
user425367

Reputation:

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.

Upvotes: 0

user425367
user425367

Reputation:

You have a compilation error. Hold your cursor over the error in the IDE (Eclipse) and post the error message.

Upvotes: 0

Related Questions