| | |
/Code: Hello, Please Help Me! I need help in java Project
![]() |
•
•
Join Date: Aug 2005
Posts: 3
Reputation:
Solved Threads: 0
I am getting an error message "Exception in thread "main" java.lang.NoClassDefFoundError
rojectta
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();
}
}
rojecttaimport 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();
}
}
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
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
Creationz Unlimited - Software ,web , forums , graphic work , Logos
Dreamzsportz Online - Want your big break in sports?
Kakkanat Home Stay - Plan your next vacation to India
Dreamzsportz Online - Want your big break in sports?
Kakkanat Home Stay - Plan your next vacation to India
•
•
Join Date: Jul 2005
Posts: 55
Reputation:
Solved Threads: 0
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).
•
•
Join Date: Nov 2007
Posts: 6
Reputation:
Solved Threads: 0
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);
}
}
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);
}
}
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.
Java Programmer and Sun Systems Administrator
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
----------------------------------------------
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
![]() |
Similar Threads
- engg. java project (Java)
- Java project ideas (Java)
- hi im new to java project (Java)
- Best Java Project (Java)
- Java project (Java)
Other Threads in the Java Forum
- Previous Thread: how do i create a simple drawing tool?
- Next Thread: Needs Brainstorming!!!
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress input integer intellij j2me java javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle physics plazmic print problem program programming project recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree trolltech unlimited utility webservices windows






