Protobuf - Java

164 views
Skip to first unread message

Alessio Sacco

unread,
Dec 14, 2016, 9:24:39 AM12/14/16
to grp...@googlegroups.com
Hello,
I'm new in gRPC.
I'm able to create Java classes for message type from proto file. But I can't generate a Java class for the stubs ( e.g. RouteGuideGrpc.java in the tutorial ).
How can I generate a class of that type? I write a command of this type :

protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto
Is it not enough?

Thank you.
Alessio Sacco

Penn (Dapeng) Zhang

unread,
Dec 14, 2016, 4:53:16 PM12/14/16
to grpc.io, ale.s...@gmail.com
protoc does not generate stubs. You might use the proto-plugin binaries from the "protoc-gen-grpc-java" artifact in the (local/central) maven repo. For example, https://github.com/grpc/grpc-java/blob/master/examples/pom.xml

Eric Anderson

unread,
Dec 14, 2016, 8:28:38 PM12/14/16
to Alessio Sacco, grpc-io
The java_out just enables Java codegen, not grpc-java codegen. You need to use protoc-gen-grpc-java as well. I'd highly recommend using the gradle/maven protoc plugins that we document in our main README. If you really want to run protoc manually, the compiler README should help you get it working.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAG6eabX9t8jg_35gGWb5gJy%3Dcia%3Di1xf27E_CELte4Pi1ZWdKQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages