title: class, interface, or enum expected error when packaging java code with maven
body: <p>I am trying to use maven to compile some Java code to run on Spark. I have all my code inside my main method except for a helper class. I feel the problem is that I am not defining the class in the right spot. I have tried putting it inside the main method, after the class that has the main method, and before the class. Do I need an entire separate file to put this class? When I run</p>
  
  <pre><code>mvn package
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-    plugin:2.0.2:compile (default-compile) on project simple-project: Compilation failure: Compilation failure:
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:   [10,7] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[12,11] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[14,9] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[15,4] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[17,11] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[19,4] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[21,11] class, interface, or enum expected
  [ERROR] 
  [ERROR] /home/peter/Desktop/spark/spark-1.1.0/sent-svm/src/main/java/GenClassifiers.java:[23,4] class, interface, or enum expected
  [ERROR] -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal    org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project   simple-project: Compilation failure
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
  at     org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilde    r.java:84)
  at      org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilde    r.java:59)
  at     org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.jav    a:183)
  at     org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
  at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
  at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
  at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
  at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
  at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:622)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
  at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
  at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
  at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
  Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
  at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
  at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
  at     org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:    101)
  at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
  ... 19 more
  [ERROR] 
  [ERROR] 
  [ERROR] For more information about the errors and possible solutions, please read the     following articles:
  [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  </code></pre>
  
  <p>Here is my current code, trying to put the class first, then followed by the rest of the code:</p>
  
  <pre><code>/* SimpleApp.java */
  import org.apache.spark.api.java.*;
  import org.apache.spark.SparkConf;
  import org.apache.spark.api.java.function.Function;
  import cmu.arktweetnlp.Twokenize;
  import java.util.*;
  import java.io.*;
  
  
  public Class Tweet {
  
      public Tweet(List&lt;String&gt; tokens, String sentiment) {
          private List&lt;String&gt; tweetTokens = tokens;
          private String label = sentiment;
      }
  
      public List&lt;String&gt; getTokens() {
          return tweetTokens;
      }
  
      public String getLabel() {
          return label;
      }
  }
  
  
  public class GenClassifiers {
      public static void main(String[] args) {
  </code></pre>