Extract the fully-qualified service name into a public static final field on the service container type.
diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp
index ed90c03..d231394 100644
--- a/compiler/src/java_plugin/cpp/java_generator.cpp
+++ b/compiler/src/java_plugin/cpp/java_generator.cpp
@@ -421,7 +421,7 @@
   p->Indent();
   p->Print(*vars,
            "return "
-           "$ServerServiceDefinition$.builder(\"$Package$$service_name$\")\n");
+           "$ServerServiceDefinition$.builder(SERVICE_NAME)\n");
   p->Indent();
   for (int i = 0; i < service->method_count(); ++i) {
     const MethodDescriptor* method = service->method(i);
@@ -514,6 +514,11 @@
       "public class $service_class_name$ {\n\n");
   p->Indent();
 
+  p->Print(
+      *vars,
+      "public static final String SERVICE_NAME = "
+      "\"$Package$$service_name$\";\n\n");
+
   PrintMethodFields(service, vars, p, generate_nano);
 
   p->Print(
diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt
index 105aaba..9237548 100644
--- a/compiler/src/test/golden/TestService.java.txt
+++ b/compiler/src/test/golden/TestService.java.txt
@@ -16,6 +16,8 @@
 @javax.annotation.Generated("by gRPC proto compiler")
 public class TestServiceGrpc {
 
+  public static final String SERVICE_NAME = "grpc.testing.TestService";
+
   // Static method descriptors that strictly reflect the proto.
   @io.grpc.ExperimentalApi
   public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.SimpleRequest,
@@ -220,7 +222,7 @@
 
   public static io.grpc.ServerServiceDefinition bindService(
       final TestService serviceImpl) {
-    return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
+    return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
       .addMethod(io.grpc.ServerMethodDefinition.create(
           METHOD_UNARY_CALL,
           asyncUnaryCall(
diff --git a/compiler/src/test/golden/TestServiceNano.java.txt b/compiler/src/test/golden/TestServiceNano.java.txt
index 916fe6b..5c05e98 100644
--- a/compiler/src/test/golden/TestServiceNano.java.txt
+++ b/compiler/src/test/golden/TestServiceNano.java.txt
@@ -18,6 +18,8 @@
 @javax.annotation.Generated("by gRPC proto compiler")
 public class TestServiceGrpc {
 
+  public static final String SERVICE_NAME = "grpc.testing.TestService";
+
   // Static method descriptors that strictly reflect the proto.
   @io.grpc.ExperimentalApi
   public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.SimpleRequest,
@@ -282,7 +284,7 @@
 
   public static io.grpc.ServerServiceDefinition bindService(
       final TestService serviceImpl) {
-    return io.grpc.ServerServiceDefinition.builder("grpc.testing.TestService")
+    return io.grpc.ServerServiceDefinition.builder(SERVICE_NAME)
       .addMethod(io.grpc.ServerMethodDefinition.create(
           METHOD_UNARY_CALL,
           asyncUnaryCall(