That javac invocation is failing because it is not being given the generated code from the protobuf compiler (protoc). I would recommend building the Java examples by running "make java"; just make sure that protoc is on your PATH and that the protobuf JAR is in your CLASSPATH.
On Tue, Nov 8, 2016 at 2:16 AM, Vivek kumar <[email protected]> wrote: > ac3@ac3-Veriton-Series:~$ javac AddPerson.java -cp protobuf-java-3.0.0.jar > > its shows error: > > > AddPerson.java:3: error: package com.example.tutorial.AddressBookProtos > does not exist > import com.example.tutorial.AddressBookProtos.AddressBook; > ^ > AddPerson.java:4: error: package com.example.tutorial.AddressBookProtos > does not exist > import com.example.tutorial.AddressBookProtos.Person; > ^ > AddPerson.java:15: error: cannot find symbol > static Person PromptForAddress(BufferedReader stdin, > ^ > symbol: class Person > location: class AddPerson > AddPerson.java:17: error: package Person does not exist > Person.Builder person = Person.newBuilder(); > ^ > AddPerson.java:17: error: cannot find symbol > Person.Builder person = Person.newBuilder(); > ^ > symbol: variable Person > location: class AddPerson > AddPerson.java:38: error: package Person.PhoneNumber does not exist > Person.PhoneNumber.Builder phoneNumber = > ^ > AddPerson.java:39: error: package Person does not exist > Person.PhoneNumber.newBuilder().setNumber(number); > ^ > AddPerson.java:44: error: package Person does not exist > phoneNumber.setType(Person.PhoneType.MOBILE); > ^ > AddPerson.java:46: error: package Person does not exist > phoneNumber.setType(Person.PhoneType.HOME); > ^ > AddPerson.java:48: error: package Person does not exist > phoneNumber.setType(Person.PhoneType.WORK); > ^ > AddPerson.java:68: error: package AddressBook does not exist > AddressBook.Builder addressBook = AddressBook.newBuilder(); > ^ > AddPerson.java:68: error: cannot find symbol > AddressBook.Builder addressBook = AddressBook.newBuilder(); > ^ > symbol: variable AddressBook > location: class AddPerson > 12 errors > please help im new to protocol buffer > > On Tuesday, August 31, 2010 at 3:55:02 PM UTC+5:30, David Portabella wrote: >> >> Hello, >> >> I don't manage to compile the java example. >> I do as follows (I've tried with OSX and Cygwin, with the exact same >> results): >> >> Download protobuf-2.3.0.zip from: http://code.google.com/p/protobuf/ >> unzip protobuf-2.3.0.zip >> cd protobuf-2.3.0 >> ./configure >> # ./configure --disable-shared # in case of Cygwin >> make >> make check >> make install >> >> # note: compilation fails if the directory name contains blank spaces. >> >> export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig >> cd examples >> make cpp >> ./add_person_cpp test.bin # this works. >> >> make java >> -- javac AddPerson.java ListPeople.java com/example/tutorial/ >> AddressBookProtos.java >> -- com/example/tutorial/AddressBookProtos.java:12: package >> com.google.protobuf does not exist >> >> cp -r ../java/src/main/java/com/* com/ # I shouldn't need to do >> this. i guess that the makefile should include the classpath. >> make java >> -- javac AddPerson.java ListPeople.java com/example/tutorial/ >> AddressBookProtos.java >> -- ./com/google/protobuf/Descriptors.java:33: package >> com.google.protobuf.DescriptorProtos does not exist >> >> find .. -iname "*DescriptorProtos*" >> -- nothing, this file does not exist. >> >> Where should I get this class from >> com.google.protobuf.DescriptorProtos? >> >> >> Many thanks, >> David >> > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
