• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

how to execute simple swing program

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am able to compile a very simple Swing example:



But when I try to run it, I get the following error:



How do I fix this problem?
 
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like a classpath issue. If you do a search for classpath here you should find quite a bit.
 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I agree. Here is what my classpath is set to:



The very first entry in my classpath is the current directory which is where I am trying to execute the program. So I do not see the problem...
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And there is a SimpleTableDemo.class file in the download directory?
 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the SimpleTableDemo.class file is in c:\download.

The message indicates to me that it is not able to find the JFrame.setDefaultLookAndFeelDecorated(true) method. I think that the JFrame class is implemented in jre\lib\rt.jar (based upon a google search). However I am having problems looking in rt.jar. I think that I should be able to say jar -t rt.jar in order to see all of the classes that are implemented in the file. But when I do this the screen just hangs and I don't get any output.

I've tried adding c:\j2sdk1.4.2_7\jre\lib\rt.jar to my classpath, but this doesn't see to remedy the situation.

Here is the current output:


[ March 04, 2005: Message edited by: Robin Clark ]
 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, finally I am able to get the simple program to run successfully. This is what my classpath looks like:

 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In my older cmd.exe window I still couldn't get the program to execute. I determined what I needed to do to fix the problem was to change my path environment variable to put the c:\j2sdk1.4.2_07\bin at the very beginning of the path. I have NO idea why this fixed the problem. Can someone explain this to me?

Path after I moved c:\j2sdk1.4.2_07\bin to the beginning. Right after I did this the SimpleTableDemo program would execute successfully.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic