title: Java Program not executing outside the bin directory and compiles
body: <p>i updated version of java from jdk6 to java7 but i am facing a serious problem whenever i execute any java file outside the bin directory it shows class not found.while in bin directory it executes however i have included classpath and path.javac compiles the java file and java class also exist in same directory but java can't execute the class file.i searched it got something like java -cp . classfilename but it also fails by saying illegal argument cp.please help.
  <a href="http://s27.postimg.org/y65yn8cfn/Capture.jpg" rel="nofollow">here is the image</a>
  it is my java file</p>
  
  <pre><code>     &lt;pre&gt;    
        import java.awt.*;
        import java.awt.event.*;
        import javax.swing.*;
        import java.io.*;
  
        public class MotionDetector extends JFrame 
        {
            // GUI components
         private MotionPanel motionPanel;
  
  
           public MotionDetector()
            {
           super("Motion Detector");
  
              Container c = getContentPane();
              c.setLayout( new BorderLayout() );   
  
              motionPanel = new MotionPanel(); // the sequence of pictures appear here
              c.add( motionPanel, BorderLayout.CENTER);
  
             addWindowListener( new WindowAdapter() {
             public void windowClosing(WindowEvent e)
            { motionPanel.closeDown();    // stop snapping pics
              System.exit(0);
             }
            });
           setResizable(false);
               pack();  
           setLocationRelativeTo(null);
             setVisible(true);
           }
           public static void main( String args[] )
              {  new MotionDetector();  }
            }
  </code></pre>
  
  <p>C:\MotionDetection>javac MotionDetector.java</p>
  
  <p>C:\MotionDetection>java MotionDetector<br>
  Can't find class MotionDetector</p>