• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing classes not recognized

 
Neil Marsden
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I 'm stuck with a problem I've never seen before and was hoping you could help.
Out of all 72 of my students, there is one chap whose Java Virtual Machine doesn't seem to recognize any of the Swing class libraries.
I've reinstalled different JDK binary sources, different versions (1.3 and 1.4) and even tried installing the JDK on different drives. All of his applications run fine on other machines.
The odd thing is this: all Swing application code will compile fine but at runtime the JDK will give me errors relating to anything having to do with the Swing libraries:
For example: after importing java.swing.*; and java.awt.*; , I'll try to access and add JButtons to a content pane. The program compiles but running the application gives me a string of errors relating only to Swing related components like the content pane.
Funny thing is, in a text editor like TextPad, a Swing class like JButton shows up with the Button text of JButton highlighted but the 'J' non-highlighted. It appeared as though only the awt libraries are being recognized (ie: Button).
Anyone ever seen this problem? I'm hoping a reimage isn't necessary!
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is it a typo??
you need to import javax.swing.*;

you wrote java.swing.* .....

could that be the problem?
 
Neil Marsden
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My apologies - I did indeed make a typo posting to the Java Ranch - I meant to put javax.swing.*; !
Unfortunately, I wish this problem were a typing error within the actual program. Thank you for your keen eye though!
-Neil
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
darn i thought it might be it...
another thought i got is this: if you say it works on all computers but his then from pure didaction the problem is in HIS computer!
maybe there is (and this happnned to me once) some jdk files that didnt get delete from older versions and are lurking around the windows\programs directory
try doing a search in his hard drive. and delete MANUALLY all those files the automatic uninstall didnt do and that are related to java. (especially java.exe and javac.exe)
then reinstall 1.4 and see if it works...
 
Neil Marsden
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the tips my friend.
It is very possible that older JDK files may be lurking in the system background...I will check it out and delay wiping the entire drive clean!
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad i could help
Keep me posted if you can if it worked. I'd really like to know - as i face the same problems with my students !
there is always that one student that keep getting the most "bizzare" - "annoying" - "i-have-no-clue-what-to-do" problems
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!