title: Java Compiling Error in Command prompt: class file has wrong version 52.0, should be 50.0
body: <p>I create a java library program and used it in another java program as .jar file. My IDE is NetBeans.  I tried the same concept via command line and I got the following error:</p>
  
  <blockquote>
    <p>class file has wrong version 52.0, should be 50.0 Please remove or
    make sure it appears in the correct sub directory of the class path. 
    import Demo1_Lib.Test1;
                    ^</p>
  </blockquote>
  
  <p>This are my steps. </p>
  
  <p><strong>Step 1:</strong>  Created the following class library in NetBeans IDE.</p>
  
  <pre><code>  package Demo1_Lib;
  
   /**
    *
    * @author tveluppillai
   */
  public class Test1 
  {
    public void print() 
    {
      System.out.println("hello");
    }    
   }
  </code></pre>
  
  <p><strong>Step 2:</strong> Create a java project on netbeans and add the jar file. (Test1.jar) and consume the class library function. </p>
  
  <pre><code> package test2;
  
   import Demo1_Lib.Test1;
  
   /**
   *
      * @author tveluppillai
   */
  
    public class Test2 
    {
  
     /**
      * @param args the command line arguments
      */
      public static void main(String args[]) 
     {
       Test1 obj = new Test1();
       obj.print();       
      }
  
   } 
  </code></pre>
  
  <p>This compiles fine and when I ran, it gives me the right output in NetBeans </p>
  
  <p>However, when I do the same thing using command prompt I got error. </p>
  
  <p>I used the following command to compile and run it. </p>
  
  <pre><code>javac -cp C:\\Demo_Lib\\Test\\Test1.jar Test2.java
  </code></pre>
  
  <p>I got the following error: </p>
  
  <blockquote>
    <p>class file has wrong version 52.0, should be 50.0 Please remove or
    make sure it appears in the correct sub directory of the class path. 
    import Demo1_Lib.Test1;
                    ^</p>
  </blockquote>
  
  <p>What am I missing? </p>