title: How can I run an Eclipse compiled Java class from the command line?
body: <p>I am writing a basic TCP chat program and one of the requirements is that it can be run from the command line with the following argument formats:</p>
  
  <pre><code>java Server 8888
  java Client localhost 8888
  </code></pre>
  
  <p>Which will start a server listening on 8888 and which waits to accept incoming connections from clients. Then start a client and connect to the server at localhost:8888. These classes can both be compiled and run from within Eclipse and I have added the above variables to the run configurations for the classes, respectively.</p>
  
  <p>If I navigate to the directory of the files in CMD I can see the compiled .class files, but when I try to run the server with:</p>
  
  <pre><code>java Server 8888
  </code></pre>
  
  <p>I get the error</p>
  
  <pre><code>Error: Could not find or load main class Server
  </code></pre>
  
  <p>Eclipse>Window>Preferences>Java>Compiler shows <strong>JDK 1.7</strong>. </p>
  
  <p>Running java -version from the command line shows</p>
  
  <pre><code>java version "1.7.0_02"
  Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
  Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
  </code></pre>
  
  <p>I want to be able to run both the classes from separate prompts in parallel. Any ideas?</p>