title: Using Java.util.scanner with command prompt
body: <p>I'm trying to get this program to run solely out of the command line (command prompt in this case) but when I create a .jar but I keep getting this error:</p>
  
  <pre><code>Expception in thread "main" java.lang.UnsupportedClassVersionError: Exponentiation: Unsupported major.minor version 51.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(Unknown Source)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$000(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
  Could not find the main class: Exponentiation. Program will exit.
  </code></pre>
  
  <p>The program is:</p>
  
  <pre><code>//import scanner for user input
  import java.util.Scanner;
  
  public class Exponentiation
  {
  
  static long values[]; //array of values to be computed
  static long output[]; //array of computed values
  static int numberExp; //number times the experiment is run
  static int currentExp = 1; //current time the experiment is running
  
  //main method
  public static void main(String [] args)
  {
      //run initial setup and random generating
      setup();
  
      //run the interative and recursive components until the user specified number of experiments
      for (currentExp = 1; currentExp &lt;= numberExp; currentExp++)
      {
          iterative();
          recursive();
      }
  
  } //close main method
  
  //runs the trail iteratively
  public static void iterative()
  {
      //create variables for time
      long initialTime;
      long endTime;
      long diffTime;
  
      //record initial time
      initialTime = System.nanoTime();
  
      //for every value exponetiate
      for (int counter = 1; counter &lt;= values[0]; counter++)
      {
          //raise every value by its opposing value in the array
          output[counter] = values[counter]^values[(int)values[0] + 1 - counter];
      }
  
      //recourd end time
      endTime = System.nanoTime();
  
      //calculate the difference
      diffTime = endTime - initialTime;
  
      //output time values
      System.out.println();
      System.out.println("Experiment " + currentExp + " Iterative:");
      System.out.println(initialTime);
      System.out.println(endTime);
      System.out.println(diffTime);
  } //close iterative method
  
  //runs the trial recursively
  public static void recursive()
  {
      //create variables for time
      long initialTime;
      long endTime;
      long diffTime;
  
      //record initial time
      initialTime = System.nanoTime();
  
      //for every value exponetiate
      for (int counter = 1; counter &lt;= values[0]; counter++)
      {
          //raise every value by its opposing value in the array using the recursive method
          output[counter] = recursiveExpo(values[counter],values[(int)values[0] + 1 - counter]);
      }
  
      //recourd end time
      endTime = System.nanoTime();
  
      //calculate the difference
      diffTime = endTime - initialTime;
  
      //output time values
      System.out.println();
      System.out.println("Experiment " + currentExp + " Recursive:");
      System.out.println(initialTime);
      System.out.println(endTime);
      System.out.println(diffTime);
  }  //close recursive method
  
  public static long recursiveExpo(long base, long expo) {
      if (expo == 0) {
          return 1;
      } else {
          return base * recursiveExpo(base, expo - 1);
      }
  } //close recursiveExpo
  
  //setup method - runs all setup isolated from the main program
  public static void setup()
  {
  
      int lowRange; //lowest possible random value
      int highRange; //highest possible random value
      int numOfTrials; //number of trials/random numbers to be generated
  
      //create scanner for user input
      Scanner input = new Scanner( System.in );
  
      //runs the random number generator until a good assortment is found
      for (boolean goodRandom = false; goodRandom == false;)
      {
  
          //clear values[], just in case
          values = null;
  
          System.out.println("This is the program for Iterative Exponetiation");
          System.out.println("Enter your prefered range of numbers");
  
          System.out.println("Lowest possible number");
          lowRange = input.nextInt(); //store min random number
  
          System.out.println("Highest possible number");
          highRange = input.nextInt(); //store max random number
  
          System.out.println("Number of trials");
          numOfTrials = input.nextInt(); //store number of trials
  
          System.out.println("How many times should the experiment be run?");
          numberExp = input.nextInt(); //store number of experiments
  
          //create array of the correct size and store the size in the 0th element
          values = new long[numOfTrials+1];
          values[0] = numOfTrials;
  
          //make the output array the same lenght
          output = new long[numOfTrials+1];
  
          //generate random values for each element until the numOfTrials is reached
          for (int counter = 1; counter &lt;= numOfTrials; counter++)
          {
              values[counter] = (int)(Math.random()*(highRange)) + lowRange;
          }
  
          //create output and concatinate numbers
          for (int counter = 0; counter &lt;= values[0]; counter++)
          {
              //add a line break every tenth number
              //and output the values[]
              if ((int)(counter/10) == (((double)counter)/10))
              {
                  System.out.println(values[counter] + " ");
              } else {
                  System.out.print(values[counter] + " ");
              }
  
          }
  
          System.out.println("Enter 1 to use these values or 0 for new ones");
  
          //regenerate or not?
          if (input.nextInt() == 1)
          {
              goodRandom = true; //continue on the actual test
          }
  
      } //close number-generator loop
  
  } //close setup method
  
  } //close Expo class
  </code></pre>
  
  <p>I think I'm doing something wrong with scanner, but I'm not sure what.  </p>