473,395 Members | 1,443 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

NullpointerException

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
wat does it mean...
how to debug this runtime error..
Help me.. plz....

Regards
pradeep
Sep 10 '07 #1
4 2363
Nepomuk
3,112 Expert 2GB
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
wat does it mean...
how to debug this runtime error..
Help me.. plz....

Regards
pradeep
A NullPointerException means, that it can't find something, that should be there. However, without the code, which throws this Exception, we'll hardly be able to help you.

Greetings,
nepomuk
Sep 10 '07 #2
r035198x
13,262 8TB
Do not flood the forum with the same question.
NullPointerException means that you derefenced a null value. One of your variables was pointing to the null reference (nothing) and you dereferenced it.
Sep 10 '07 #3
hi ...
this is the program .. where i got runtime error.., can u say me where i hav done a mistake....

import java.applet.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import sun.jdbc.odbc.*;
public class SPlanting extends Frame implements ActionListener
{
TextField date,nom,tb,tl,st,ft,pc,on;
Label l1,l2,l3,l4,l5,l6,l7,l8;
Button save,exit;
Connection con;
ResultSet rs;
Statement stmt;
String s1,s2,s8;
int s3,s4,s5,s6,s7;
public SPlanting()
{
super("SPlanting ");
setSize(800,800);
setLayout(new GridLayout(7,2,45,45));
l1=new Label("Date");
l2=new Label("Noofmixes");
l3=new Label("TotalBentomikused");
l4=new Label("TotalLusformused");
l5=new Label("starttime");
l6=new Label("Offtime");
l7=new Label("PowerConsumed");
l8=new Label("Opertorname");


add(l1);
add(date);
add(l2);
add(nom);
add(l3);
add(tb);
add(l4);
add(tl);
add(l5);
add(st);
add(l6);
add(ft);
add(l7);
add(pc);
add(l8);
add(on);

save.addActionListener(this);
exit.addActionListener(this);
setVisible(true);

try
{
Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
con=DriverManager.getConnection("jdbc.odbc.prism") ;
stmt=con.createStatement();
rs=stmt.executeQuery("select * from SPlanting ");
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException e)
{
System.out.println(e);
}
addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent w) {System.exit(0);}});
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==save)
{
s1=date.getText();
s2=nom.getText();
s3=Integer.parseInt(tb.getText());
s4=Integer.parseInt(tl.getText());
s5=Integer.parseInt(st.getText());
s6=Integer.parseInt(ft.getText());
s7=Integer.parseInt(pc.getText());
s8=on.getText();
try
{
String query ="insert into SPlanting(Date,Noofmixes,TotalBentomikused,TotalLu sformused,starttime,Offtime,PowerConsumed,Opertorn ame,Offtime,Shortage,Cycles/day)"+ "values('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+ "','"+s6+"','"+s7+"','"+s8+"')";
Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:prism") ;
stmt=con.createStatement();
rs=stmt.executeQuery(query);
stmt.close();
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException e)
{
System.out.println(e);
}
}
if(ae.getSource()==exit)
{
System.exit(0);
}
}
public static void main(String args[])
{
SPlanting sp=new SPlanting();
}
}


regards
pradeep
Sep 10 '07 #4
r035198x
13,262 8TB
hi ...
this is the program .. where i got runtime error.., can u say me where i hav done a mistake....

import java.applet.*;
import java.awt.*;
import java.sql.*;
import java.awt.event.*;
import sun.jdbc.odbc.*;
public class SPlanting extends Frame implements ActionListener
{
TextField date,nom,tb,tl,st,ft,pc,on;
Label l1,l2,l3,l4,l5,l6,l7,l8;
Button save,exit;
Connection con;
ResultSet rs;
Statement stmt;
String s1,s2,s8;
int s3,s4,s5,s6,s7;
public SPlanting()
{
super("SPlanting ");
setSize(800,800);
setLayout(new GridLayout(7,2,45,45));
l1=new Label("Date");
l2=new Label("Noofmixes");
l3=new Label("TotalBentomikused");
l4=new Label("TotalLusformused");
l5=new Label("starttime");
l6=new Label("Offtime");
l7=new Label("PowerConsumed");
l8=new Label("Opertorname");


add(l1);
add(date);
add(l2);
add(nom);
add(l3);
add(tb);
add(l4);
add(tl);
add(l5);
add(st);
add(l6);
add(ft);
add(l7);
add(pc);
add(l8);
add(on);

save.addActionListener(this);
exit.addActionListener(this);
setVisible(true);

try
{
Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
con=DriverManager.getConnection("jdbc.odbc.prism") ;
stmt=con.createStatement();
rs=stmt.executeQuery("select * from SPlanting ");
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException e)
{
System.out.println(e);
}
addWindowListener(new WindowAdapter(){
public void WindowClosing(WindowEvent w) {System.exit(0);}});
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==save)
{
s1=date.getText();
s2=nom.getText();
s3=Integer.parseInt(tb.getText());
s4=Integer.parseInt(tl.getText());
s5=Integer.parseInt(st.getText());
s6=Integer.parseInt(ft.getText());
s7=Integer.parseInt(pc.getText());
s8=on.getText();
try
{
String query ="insert into SPlanting(Date,Noofmixes,TotalBentomikused,TotalLu sformused,starttime,Offtime,PowerConsumed,Opertorn ame,Offtime,Shortage,Cycles/day)"+ "values('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+ "','"+s6+"','"+s7+"','"+s8+"')";
Class.forName("sun.jdbc.odbc.Jdbc.OdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:prism") ;
stmt=con.createStatement();
rs=stmt.executeQuery(query);
stmt.close();
}
catch(ClassNotFoundException e)
{
System.out.println(e);
}
catch(SQLException e)
{
System.out.println(e);
}
}
if(ae.getSource()==exit)
{
System.exit(0);
}
}
public static void main(String args[])
{
SPlanting sp=new SPlanting();
}
}


regards
pradeep
This is the second time I'm telling you to use code tags when posting code. (that's not a good thing on your part).
Keep this problem in this original thread. Double posting is also against site rules.

This thread will now be closed.
Sep 10 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: K S Aldebaraan | last post by:
I'm trying to submit a form with an action of a servlet, and a view equal to the same jsp page. I'm not sure what I'm doing wrong, but keep getting a NullPointerException on the second line of...
4
by: gabryh | last post by:
Hi, The following code throws me NullPointerException. ..... public static boolean isEmpty(String value) { return ((value == null) || (value.trim().equals(""))); }
0
by: Old-timer | last post by:
Not sure where else to post this. I'm sure I'm doing something wrong, but I wouldn't think a simple app would give me so much trouble. I've got a small test java class that I'm trying to have...
2
by: Smith | last post by:
The program compiled successfully, but it gives the following error on runtime.... java.lang.NullPointerException at FrogManiaApp.paint(FrogManiaApp.java:102) at...
13
oll3i
by: oll3i | last post by:
private List<Klient> klienci; m_add_client.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { ...
1
by: ketand1 | last post by:
import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.sql.*; import java.lang.*; class DbAwt extends Frame implements ActionListener { private...
2
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
1
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that...
1
by: r035198x | last post by:
This exception occurs often enough in practice to warrant its own article. It is a very silly exception to get because it's one of the easiest exceptions to avoid in programming. Yet we've all got it...
3
by: chris123456789 | last post by:
Hi, when I run my code I get a NullPointerException:null. Here is the part of the code where the error occurs: import java.util.*; import java.io.*; public class Decrypt { ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.