• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Runtime error in JTable

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may seem very basic to some of you. But since it is the first time I am new to Java I would like to know what could be done to fix my problem.
I am writing code to create JTable and it compiles fine but when I run it this is the error message:
Exception in thread "main" java.lang.NoClassDefFoundError:suncertify\db\FbnModel (wrong name suncertify/db/FbnModel)
Here are some snippets
public class FbnModel extends JFrame
{
...
public void FlyTableModel() throws IOException
{
.....
}
class FlyTableModel extends AbstractTableModel
{
}
public FbnModel()
{
FlyTableModel model = new FlyTableModel();
JTable table = new JTable(model);
}
public static void main(String[] args)
{
FbnModel frame = new FbnModel();
frame.pack();
frame.
}
}
Any hints would be appreciated
Krishnan

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look VERY HARD at the following code snippet
public FbnModel()
{
FlyTableModel model = new FlyTableModel();
JTable table = new JTable(model);
}
Do a step by step analysis on what is happening. Hint, what happens at the end of the function?
[This message has been edited by Gurpreet Aulakh (edited March 06, 2001).]
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
May be i'm wrong. Have u packaged this java file under
suncertify.db? if yes then try running by typing the following on the command prompt.
java suncertify.db.FBNModel
If NO then java FBNModel s'd work from the directory where u compiled the FBNModel file.
regards
karthik.

Originally posted by Swati krishnan:
This may seem very basic to some of you. But since it is the first time I am new to Java I would like to know what could be done to fix my problem.
I am writing code to create JTable and it compiles fine but when I run it this is the error message:
Exception in thread "main" java.lang.NoClassDefFoundError:suncertify\db\FbnModel (wrong name suncertify/db/FbnModel)
Here are some snippets
public class FbnModel extends JFrame
{
...
public void FlyTableModel() throws IOException
{
.....
}
class FlyTableModel extends AbstractTableModel
{
}
public FbnModel()
{
FlyTableModel model = new FlyTableModel();
JTable table = new JTable(model);
}
public static void main(String[] args)
{
FbnModel frame = new FbnModel();
frame.pack();
frame.
}
}
Any hints would be appreciated
Krishnan


 
Swati krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I packaged it under suncertify.db and have all the classpaths and directories set up as required to the best of my knowledge. But still I am getting the same error.
Also I am unable to find any error in the public FbnModel() code.
How can I get this code to run.
Thanks in advance
Krishnan
 
Gurpreet Aulakh
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Also I am unable to find any error in the public FbnModel() code."
If the contructor is exactly as you have written it then YES THERE IS A PROBLEM !!!
I am not going to tell you the answer you will have to figure it out on your own. I will tell you that what you think the contructor is doing and what it actually is doing are two separate things. What you should do is step through the code with a debugger and check each value. You will quickly see what is happening. Read the previous hint that I gave you! WHAT HAPPENS AT THE END OF THE FUNCTION CALL!!
 
Swati krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried fixing it by the following super("FbnModel");
and then made model and table global but still get the same error. Its phasing me out
Krishnan
public FbnModel()
{
super("FbnModel");
model = new FlyTableModel();
table = new JTable(model);
}
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Swati:
I hardly to find the problems with the code you gave. Is it possible the problem related with the runing command when you start Java VM.
Did you start the executing your coding like this:
java suncertify.db.FbnModel
It should start the class with it's package name, not the directory structure name like: java suncertify/db/FbnModel, which definitely gave your ClassNotFoundExceptions in you case
David
 
Swati krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks david, seems like that was it
java suncertify.db.FbnModel
Thanks for bringing it to my attention
Krishnan
 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
davidlong,
Please read the JavaRanch Naming Policy and register using a name that complies with the rules.
Thank you,
Sam Wong
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic