title: I get NoClassDefFoundError, how can i fix it?
body: <p>when i run my java application with eclipse i don't get any problem but when i run it with the command prompt i get NoClassDefFoundError.</p>
  
  <pre><code>C:\Windows\System32&gt;cd C:\Users\Caco\workspace\Bisquit_server\bin\bisquit_server
  C:\Users\Caco\workspace\Bisquit_server\bin\bisquit_server&gt;java ReceiveMsg
  Exception in thread "main" java.lang.NoClassDefFoundError: ReceiveMsg (wrong nam
  e: bisquit_server/ReceiveMsg)
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
      at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
  
  
  C:\Users\Caco\workspace\Bisquit_server\bin\bisquit_server&gt;
  </code></pre>
  
  <p>this is my java code:</p>
  
  <pre><code>package bisquit_server;
  import java.io.*;
  import java.net.*;
  
  public class ReceiveMsg {
  
      private ServerSocket server_socket;
      private Socket socket;
      ObjectInputStream input_stream;
      private static String msg;
  
      public ReceiveMsg() throws IOException, ClassNotFoundException{
      try
      {
  
          server_socket=new ServerSocket(50000,1);
          while(true){
              listen();
              System.out.print("Server is ready to connect to a client");
              createStreams();
              initProcessing();
          }
  
      }
      finally {close();}
      }
      private void listen() throws IOException{
          socket= server_socket.accept();
          ReceiveMsgTh rmth = new ReceiveMsgTh();
          Thread t = new Thread(rmth);
      }
      private void createStreams() throws IOException{
          input_stream= new ObjectInputStream(socket.getInputStream());
      }
      private void initProcessing() throws ClassNotFoundException, IOException{
          msg = "";
          msg = (String)input_stream.readObject();
  
      }
      private void close() throws IOException{
          if (input_stream!=null &amp;&amp; socket != null){
              input_stream.close();
              socket.close();
          }
      }
  
      public static void main(String[] args) //throws ClassNotFoundException, IOException 
      {
          try {
          new ReceiveMsg();
          }
          catch(ClassNotFoundException | IOException e){}
          new Store().StoreMsg(msg,new String[]{"0987654321,"1234567890"},"1234567890");
      }
  
  }
  
  package bisquit_server;
  
  import java.io.IOException;
  import java.io.ObjectInputStream;
  import java.net.ServerSocket;
  import java.net.Socket;
  
  public class ReceiveMsgTh implements Runnable {
  
  private ServerSocket server_socket;
  private Socket socket;
  ObjectInputStream input_stream;
  
  public void StartProcess() throws IOException, ClassNotFoundException{
      try
      {
          server_socket=new ServerSocket(50000,1);
          while(true){
              listen();
              createStreams();
              initProcessing();
          }
  
  }
  finally {close();}
  }
  private void listen() throws IOException{
      socket= server_socket.accept();
  }
  private void createStreams() throws IOException{
      input_stream= new ObjectInputStream(socket.getInputStream());
  }
  private void initProcessing() throws ClassNotFoundException, IOException{
      String msg = "";
      msg = (String)input_stream.readObject();
      new Store().StoreMsg(msg,new String[]{"0987654321","1234567890"},"1234567890");
  
  }
  private void close() throws IOException{
      if (input_stream!=null &amp;&amp; socket != null){
          input_stream.close();
          socket.close();
      }
  }
  @Override
  public void run()  {
      // TODO Auto-generated method stub
      try {
          StartProcess();
      } catch (ClassNotFoundException | IOException e) {
          // TODO Auto-generated catch block
  
      }
  
  }
  
  }       
  
  
  
  
  
  
  
  package bisquit_server;
  
  import java.io.BufferedWriter;
  import java.io.File;
  import java.io.FileWriter;
  import java.io.IOException;
  
  public class Store {
  
  public void StoreMsg(String msg, String[] mobileNumbers, String whoWrite){
      File f = new File("C:\\Users\\Caco\\workspace\\Conversations\\"+mobileNumbers[0]+mobileNumbers[1]+".txt");
  
      try (
              BufferedWriter bw = new BufferedWriter(new FileWriter(f,true));
          )
              {
                  bw.write(whoWrite);
                  bw.write(" ");
                  bw.write(msg);
                  bw.write("\r\n");
              }
          catch(IOException e) {
              System.out.print("Error writing file");
          }
  
  
  }
  
  }
  </code></pre>
  
  <p>I'm really frustrated because it's three days that i try to fix it without succes!
  Can you help me? 
  Thankyou</p>