title: Problems using protobufs with java and scala
body: <p>I have a file <code>xxx.proto</code>. I downloaded the protobuf compiler and installed it. Then I issued this command </p>
  
  <pre><code>protoc --java_out=./ xxx.proto
  </code></pre>
  
  <p>and it generated my xxx.java</p>
  
  <p>Now I want to compile this file into a class file which I can use with Scala.</p>
  
  <pre><code>javac xxx.java
  </code></pre>
  
  <p>Which gives me this error</p>
  
  <pre><code>xxx.java:7: package com.google.protobuf does not exist
        com.google.protobuf.ExtensionRegistry registry) {
                           ^
  xxx.java:12450: package com.google.protobuf.Descriptors does not exist
    private static com.google.protobuf.Descriptors.Descriptor
                                                  ^
  xxx.java:12453: package com.google.protobuf.GeneratedMessage does not exist
      com.google.protobuf.GeneratedMessage.FieldAccessorTable
  
  ...
  ...
  ...
  
  100 errors
  </code></pre>
  
  <p>Now I guessed, it doesnt have the package.</p>
  
  <p>So I copied the class files of package com.google.protobuf into the same folder where xxx.java exists. Note - I didnt compile this package. I downloaded the jar from another extension which had the jar files. So I extracted them. Now my current path where xxx.java resides has com/google/protobuf/ *.class of protobuf library.</p>
  
  <p>I issued the javac command again.</p>
  
  <p>This time I got a different set of errors - </p>
  
  <pre><code>    xxx.java:10: cannot find symbol
      symbol  : class MessageOrBuilder
      location: package com.google.protobuf
            extends com.google.protobuf.MessageOrBuilder {
                                       ^
      xxx.java:215: cannot find symbol
      symbol  : class MessageOrBuilder
      location: package com.google.protobuf
              extends com.google.protobuf.MessageOrBuilder {
                                         ^
      xxx.java:608: cannot find symbol
      symbol  : class MessageOrBuilder
      location: package com.google.protobuf
              extends com.google.protobuf.MessageOrBuilder {
                                         ^
      xxx.java:1017: cannot find symbol
      symbol  : class MessageOrBuilder
      location: package com.google.protobuf
              extends com.google.protobuf.MessageOrBuilder {
  
  ..... 100 errors
  </code></pre>
  
  <p>I even tried to compile the source files which came with google protobufs. The generated java classes are giving the same errors.</p>
  
  <p>Any ideas what to do ??</p>
  
  <p><strong>Answer</strong></p>
  
  <p>Okay. Thanks everyone.</p>
  
  <p>The main problem is that protocol buffers compiler package from google doesnt by default create the java library. I assumed that it does and installs it. It actually does if you are  running Maven. But i didnt have maven</p>
  
  <p>So i compiled the code in <code>/java/src</code> and used the jar. 
                                         ^</p>