title: Exception in thread "main" java.lang.NoClassDefFoundError
body: <pre><code>package pack;
  
  
  public class sample{ 
  
   public static void main(String input[])
      {
  
          NumberFormat numberFormat = new DecimalFormat("#,##0.00##");
      System.out.println(numberFormat.format(44533125.00));
  
      } 
  }
  </code></pre>
  
  <p>the code is working fine in the current dir.. (c:/myprogram/).</p>
  
  <p>after that i copy the sample.class file and paste it in other dir(d:/myprogram).
  i got error while running, like</p>
  
  <pre>
  Exception in thread "main" java.lang.NoClassDefFoundError: sample (wrong name: pack/sample)
  </pre>
  
  <p>In java .class file can run anywhere right? but why i am not able to run?</p>