error: cannot find symbol symbol: class JTextFieldLimit class: Login <p>I have 2 files named <code>Login.java</code> and <code>JTextFieldLimit.java</code> (both files kept in <code>c:\java programs\planning sheet\with re_allotted</code>) </p> <p>Login.java </p> <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*; class Login extends JFrame implements ActionListener,KeyListener { JButton SUBMIT; JPanel panel, panel1; JLabel label1, label2; static JTextField text1, text2; Login() { label1 = new JLabel(); label1.setText("Username:"); String username = System.getProperty("user.name"); System.out.println(username); text1 = new JTextField(15); text1.setDocument(new JTextFieldLimit(7)); text1.addKeyListener(new KeyAdapter() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if(!(Character.isLetterOrDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE) || (c == KeyEvent.VK_PASTE))) { JOptionPane.showMessageDialog(null, "Only numbers and alphabets allowed"); e.consume(); } } }); text1.setText(username); text1.setEditable(false); label2 = new JLabel(); label2.setText("Password:"); text2 = new JPasswordField(15); text2.setDocument(new JTextFieldLimit(6)); text2.setEditable(false); text2.addKeyListener(this); username = username.toLowerCase(); if((("hrv1pen").equals(username)) || (("rar1pen").equals(username)) || (("sut5pen").equals(username))) text2.setText("admin"); else text2.setText(""); text2.requestFocusInWindow(); SUBMIT = new JButton("SUBMIT"); JPanel panel1 = new JPanel(new BorderLayout()); JLabel label = new JLabel(); label.setIcon(new ImageIcon("banner.jpg")); panel1.add(label,BorderLayout.EAST); JLabel label3 = new JLabel(" Login Screen"); panel1.add(label3,BorderLayout.CENTER); panel = new JPanel(new GridLayout(3,1)); panel.add(label1); panel.add(text1); panel.add(label2); panel.add(text2); panel.add(SUBMIT); add(panel1, BorderLayout.NORTH); add(panel, BorderLayout.CENTER); SUBMIT.addActionListener(this); setTitle("LOGIN FORM"); } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { } public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if(key == KeyEvent.VK_ENTER) { String username = text1.getText().trim(); username = username.toLowerCase(); String value1 = text2.getText().trim(); } } public void actionPerformed(ActionEvent ae) { String username = text1.getText().trim(); username = username.toLowerCase(); String value1 = text2.getText().trim(); if((("").equals(username)) &amp;&amp; (("").equals(value1))) { System.out.println("username and password cannot be blank"); JOptionPane.showMessageDialog(null, "Username and Password fields cannot be empty", "Error", JOptionPane.ERROR_MESSAGE); text2.setText(""); text1.setText(""); text1.requestFocusInWindow(); } } public static void main(String arg[]) { Login frame = new Login(); frame.pack(); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); } } </code></pre> <p>JTextFieldLimit.java </p> <pre><code>import javax.swing.text.PlainDocument; import javax.swing.text.*; public class JTextFieldLimit extends PlainDocument { private int limit; JTextFieldLimit(int limit) { super(); this.limit = limit; } public void insertString(int offset, String str, AttributeSet attr) throws BadLocationException { if(str == null) return; if((getLength() + str.length()) &lt;= limit) { super.insertString(offset,str,attr); } } } </code></pre> <p>All these days the file <code>Login.java</code> was compiling and running. </p> <p>But, today, when I tried to compile the file in command prompt by changing the directory to <code>c:\java programs\planning sheet\with re_allotted</code> and<br> then compiling using <code>javac Login.java</code>, I get the following compilation error: </p> <pre><code>Login.java:27: error: cannot find symbol text1.setDocument(new JTextFieldLimit(7)); symbol: class JTextFieldLimit location: class Login Login.java:53: error: cannot find symbol text2.setDocument(new JTextFieldLimit(6)); symbol: class JTextFieldLimit location: class Login </code></pre> <p>Don't know what am I doing wrong. </p> <p>Kindly guide me. </p> <p>Thanks in advance</p>