/Code: Hello, Please Help Me! I need help in java Project

Reply

Join Date: Aug 2005
Posts: 3
Reputation: 7233trebor is an unknown quantity at this point 
Solved Threads: 0
7233trebor 7233trebor is offline Offline
Newbie Poster

/Code: Hello, Please Help Me! I need help in java Project

 
0
  #1
Aug 1st, 2005
I am getting an error message "Exception in thread "main" java.lang.NoClassDefFoundErrorrojectta






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();

}

}
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 102
Reputation: yni420 is an unknown quantity at this point 
Solved Threads: 0
yni420's Avatar
yni420 yni420 is offline Offline
Junior Poster

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #2
Aug 1st, 2005
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
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
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #3
Aug 1st, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jul 2005
Posts: 55
Reputation: Sauce is an unknown quantity at this point 
Solved Threads: 0
Sauce Sauce is offline Offline
Junior Poster in Training

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #4
Aug 2nd, 2005
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).
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 3
Reputation: 7233trebor is an unknown quantity at this point 
Solved Threads: 0
7233trebor 7233trebor is offline Offline
Newbie Poster

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #5
Aug 2nd, 2005
I really do appreciate you guys help. Thank you!
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 3
Reputation: 7233trebor is an unknown quantity at this point 
Solved Threads: 0
7233trebor 7233trebor is offline Offline
Newbie Poster

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #6
Aug 2nd, 2005
I appreciate your help. Thank you
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 6
Reputation: princestasnley is an unknown quantity at this point 
Solved Threads: 0
princestasnley princestasnley is offline Offline
Newbie Poster

Re: /Code:Please Help Me! I need help

 
0
  #7
Nov 12th, 2007
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);
}
}
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,359
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 252
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven

Re: /Code: Hello, Please Help Me! I need help in java Project

 
0
  #8
Nov 12th, 2007
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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC