I am getting an error message "Exception in thread "main" java.lang.NoClassDefFoundError:Projectta

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class projectta extends JFrame

{

  private static final int WIDTH = 400;
  private static final int HEIGHT = 300;

  private JLabel directionsL;

  private JtextField textTF, messageTF;

  private JButton submitB, resetB, exitB;

  private SubmitButtonHandler sbHandler; 
  private ResetButtonHandler rbHandler; 
  private ExitButtonHandler ebHandler;  

  public projectta()

  {



     SetTitle("click the button and enter a social security number in the format 123-45-6789");



     directionsL = new JLabel("Enter a social security number here");



     textTF = new JTextField (11);
     messageTF = new JtextField(25);
     setVisible(true);



     submitB = new JButton("Submit")
     sbHandler = new SubmitButtonHandler();
     submitB.addActionListener(sbHandler);




     resetB = new JButton("Reset")
     rbHandler = new ResetButtonHandler();
     resetB.addActionListener(rbHandler);



     exitB = new JButton("Exit")
     ebHandler = new ExitButtonHandler();
     exitB.addActionListener(ebHandler);



   container pane = getContentPane();



   pane.setLayout(new GridLayout(6,1));



    pane.add(textTF);
    pane.add(messageTF);
    pane.add(submitB);
    pane.add(resetB);
    pane.add(exitB);


    setSize(WIDTH, HEIGHT);
    setVisible(true);
    setDefaultCloseoperation(EXIT_ON_CLOSE);
  }
    private class SubmitButtonHandler implements ActionListener 
  {
    public void actionPerformed(ActionEvent e)

    {

       int text;
       int message;
       text = Integer.parseInt(textTF.getText());
       message = Integer.parseInt(messageTF.getText());
       validateSsn();
   }

  }
   private class ExitButtonHandler implements ActionListener

   {

      public void actionPerformed(ActionEvent e)

      {

            System.exit(0);
      }
   }


   private class ResetButtonHandler implements ActionListener
   {

   public void actionPerformed (ActionEvent e)
   {

      String str;
      str = "";

   }
   }
    public boolean validateSsn()
    {
       String str;
       str = (textTF.getText());

       int x; 
       int t; 
           for (t = 0; t<= str.length(); t++)
       if (str.charAt(3) == '-' && str.charAT(6) == '-')
         return true;

             x = 0; 
             while (x < 3)
            if (str.charAt(x) >= 0 && str.charAt(x) <= 9)
              return true;
                  else
                 return false; 

                      x = 4; 
                          while (x < 6) 
                     if (str.charAt(x) >= 0 && str.charAt(x) <= 9)
                       return true;
                           else
                          return false; 

                               x = 7;
                        while (x < 11)
                             if (str.charAt(x) >= 0 && str.charAt(x) <= 9)
                                 return true;
                             else
                          System.out.println("ERROR! Invalid SSN");
    }
    public static void main(String[] args)
    {


                        Projectta Proj = new Projectta();

    }

 }

Edited 3 Years Ago by pyTony: fixed formating

you have defined the class name as projectta but elsewhere you have used it as Projectta.
java is case sensitive..if i remember right..
change either one and the error should go away
meaning use either projectta or Projectta everywhere
not both
also make sure that the file name you save in is the same as the name of the public class that is projectta or Projectta

Either you haven't got the case sensitivity right as the person above suggested, or the jvm/jre is not looking in the right directory. I would think it's the first.

I'd go with it being the capitalized class name in main and lowercase in his declaration. BTW...common java practice is to capitalize class names, so you might want to change it above instead of just changing it in the main. And if it stil doesn't work make sure you have the file name Projectta.java (it has to match the class name).

i am happy to be a member of this community. recently, i encountered some problems while i was working on a project, along the line, i thiught i should let my problems be known to the community.

The project has to be database driven application. here,i need to use a particular existing record to QUERY as per say, to retrieve the details of that record as long as it exists in the database.

please looking forward to hear from you as soon as possible.

import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
import javax.swing.*;
import java.sql.*;

public class CarHistory extends JFrame implements ActionListener
{
    // Initializing the variables

    JLabel caption, enterlab,chassislab,imglab,message;
    JTextField chassisfield;
    JTextArea displaysearch;
    JScrollPane scroll;
    JButton search, reset;
    ImageIcon icon;

    Connection conect;
    StringBuffer stb;
    String sql,a;
    Statement st;
    PreparedStatement pst;
    ResultSet rset;
    ResultSetMetaData rsetmet;


    public CarHistory(String title)
    {
        super(title);
        getContentPane().setLayout(null);
        getContentPane().setBackground(Color.white);

        icon = new ImageIcon("tracklogo.jpg");
        imglab = new JLabel(icon);
        imglab.setBounds(0,0,200,100);
        getContentPane().add(imglab);

        message = new JLabel("Detail Output");
        message.setBounds(380,10,200,20);
        getContentPane().add(message);

        caption = new JLabel("CAR HISTORY");
        caption.setBounds(230,80,100,20);
        getContentPane().add(caption);

        enterlab = new JLabel("ENTER CHASSIS/VIN Number of Vehicle to get History.");
        enterlab.setBounds(20,110,340,20);
        getContentPane().add(enterlab);

        chassislab = new JLabel("Chassis/Vin No:");
        chassislab.setBounds(20,135,120,20);
        getContentPane().add(chassislab);

        chassisfield = new JTextField();
        chassisfield.setBounds(130,135,100,20);
        getContentPane().add(chassisfield);

        displaysearch = new JTextArea();
        //displaysearch.setBounds(350,30,430,170);
        displaysearch.setBackground(Color.pink);
        displaysearch.setForeground(Color.white);
        displaysearch.setEditable(false);


        scroll = new JScrollPane(displaysearch);
        scroll.setBounds(350,30,430,170);
        getContentPane().add(scroll);

        search = new JButton("SEARCH");
        search.setBounds(130,180,100,20);
        getContentPane().add(search);


        reset = new JButton("RESET");
        reset.setBounds(250,180,100,20);
        getContentPane().add(reset);

        search.addActionListener(this);
        reset.addActionListener(this);
    } 
    public void actionPerformed(ActionEvent ae)
    {
        if(ae.getSource()==reset)
        {
            chassisfield.setText("");
        }
            if(ae.getSource()==search)
            {
                if((chassisfield.getText()=="")||(chassisfield.getText().length()==0))
                {
                    JOptionPane.showMessageDialog(null,"Please Enter Your Car Chassis Number.","Omited", JOptionPane.INFORMATION_MESSAGE);
                }
            else if(ae.getSource()==search)
            {
                try
                {
                //--------- Loading the driver manager-=------------======================

                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  
                System.out.println("Driver Loaded.");
                conect=DriverManager.getConnection("jdbc:odbc:digit");
                System.out.println("Connection Established");

                    st = conect.createStatement();
                    sql=new String("SELECT * from CarReg where VehicleChassis_No='"+chassisfield.getText()+"'");
                    rset =st.executeQuery(sql);
                    while(rset.next())  
                    {
                        a= rset.getString("VehicleChassis_No");
                        System.out.println(a);

                        if(chassisfield.getText().equals(a))
                        {
                            System.out.println("yes exists");
                            stb = new StringBuffer();
                            rsetmet = rset.getMetaData();
                            int numberOfColumns = rsetmet.getColumnCount(); 

                            for (int i =1; i<= numberOfColumns; i++)
                                stb.append(rsetmet.getColumnName(i) + "\t");
                                stb.append("\n");
                                while (rset.next())
                                {
                                    for (int i = 1; i <=numberOfColumns; i++)
                                    stb.append(rset.getObject(i)+ "\t");
                                    stb.append("\n");
                                }
                                    while (rset.next())
                                    {
                                        for (int i = 1; i <=numberOfColumns; i++)
                                        stb.append(rset.getObject(i)+ "\t");
                                        stb.append("\n");
                                    }

                                        while (rset.next())
                                        {
                                            for (int i = 1; i <=numberOfColumns; i++)
                                            stb.append(rset.getObject(i)+ "\t");
                                            stb.append("\n");
                                        }


                                        displaysearch.setText(stb.toString());
                                        message.setText("<<<<<   Your Car Details  >>>>>>>");    
                                        JOptionPane.showMessageDialog(null,"Data Retrieved");
                        }
                        else
                        {
                            JOptionPane.showMessageDialog(null, "No Such Chassis Number.");
                            return;                     
                        }
                    }   

                    conect.close();
                    st.close();
                    }
                    catch(Exception e){System.out.println("[SQLException:]Data Violation:ERROR."); e.printStackTrace();}
                    }
        }                               
    }
    public static void main(String args[])
    {
        CarHistory CH = new CarHistory("<<<<  AUTOMOBILE TRACKING SYSTEM   >>>>>"); 
        CH.setSize(800,250);
        CH.setVisible(true);
        CH.setResizable(false);
        CH.setLocation(200,100);
    }
}

Edited 3 Years Ago by pyTony: fixed formatting

Start your own thread. And then, state what the actual problem is (i.e. compiler/error messages or actual vs. expected results), don't just say what the end result should be and then dump alot of code. We are not going to even try to decipher it, in that case.

This article has been dead for over six months. Start a new discussion instead.