Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Swing classes not found?

Status
Not open for further replies.

gerald

Programmer
Apr 10, 2000
152
US
Hi there. I STILL havent figured out what is wrong with my system. I have installed the latest version of Java 2 SDK on a new Redhat 7 machine. Most things seem to work, I can write server side applications and regular AWT applets and even JSP and servlets using Tomcat.

However, Swing just wont work! I know it is not a browser issue because I have tested swing applets on other sites that work fine in my browser.

The basic problem is for some reason when I call the applet from a web browser, it cannot find the Swing classes. It puts the grey area the correct size for the applet but nothing else. When you put the mouse over it, I get this error on the status bar:
load: class SwingApplet not found

Then if I go into the source file, and change the class declaration from 'extends JApplet' to 'extends Applet' and recompile, it works fine. (Not doing anything really just activating the applet with no errors...)

Then I look in my apache error log and I see this:

File not found: /home/
where /home/ is where my html and java class files are for right now.

I get the same result whether I use Apache 1.3.12 or Tomcat 4.0 as my web server.

Is there something Im missing here?

I searched the entire machine for JApplet.class file and it did not find anything. I even looked in all of the .jar files and did not find it either. I did find JApplet.java in the src.jar file. I tried compiling it and creating a folder /home/ and putting it in there.
That SEEMED to have resolved that particular issue at the moment. It no longer told me that it couldnt find JApplet.class. Instead it told me this:

File not found: /home/
So I found that in the src.jar and compiled it as well. Eventually it stopped saying class SwingApplet not found int he web browser, instead it would say: class SwingApplet could not be instantiated.

Now my log file says: File not found: /home/
I do not see sun/awt in the src.jar file, however I found AppContext.java under the swing folder, so I went ahead and compiled it for the hell of it and put it under /home/ It still says that the class cant be instantiated in the web browser, but I no longer get any error messages in my apache error log. So Im now stuck! heh

Any ideas would be greatly appreciated.

Thanks alot,
Gee
 
Any time I have gotten this it is because the Browser is not set up for Java 1.2. Since JApplet is a swing feature of Java 2 it is causing the problem. Of course it will work with the Applet class because that is from older versions of Java and the old AWT.

I know Internet Explorer and Navigator are not set up for the latest Java 1.2 in the browsers. Check the site and look for the java Plugin. It is a converter which adds special tags to your .html. These tags override the browsers so Java 1.2 can execute. Since Microsoft is at war with Sun, don't count on I.E having it included in the near future.

Some browsers that are Java 2 complient are AOL and of course Suns JDK with the appletviewer. Most IDE's Visual Age, JBuilder, Visual Cafe are all Java 2 and this is not a problem.

Try bringing up the other sites pages with java 2 swings running and look at their html source. You should see plugin tags.

JApplet.class of the javax.swing package is found in rt.jar in the jre/lib.

Good luck, hope this helps.
Brian
 
Yes, Brian is right on the money. There is a good FAQ about this issue in this forum

faq269-234

Good luck
-pete
 
Thanks alot guys!
I had been told previously that the problem was with my browser not supporting Java 2, so I went and downloaded and installed the Java 2 Plug-In and it still did the same thing.

This combined with the fact that I was getting errors in my SERVER log had me pounding my head. heh. I guess I really should read more as I go, I was not aware that you still had to modify the HTML to activate the plugin. Microsoft is such a pain.....

I knew there was a reason I stuck to server side Java this long.. heh

But now I am trying to create applet interfaces to most of my server software... And I never got the hang of Java GUI when working with AWT back in the days. Hopefully Swing and my new graphical IDE toys can make a difference.

When I am done with everything it will all be posted with source code on Features include a secure email server, secure ftp server, encrypted chat system and a pretty complex and flexible e-Business Enterprise package based on J2EE architecture.

Thanks again for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top