• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to execute simple swing program

 
Robin Clark
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • 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?
 
Steven Bell
Ranch Hand
Posts: 1071
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • 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
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic