Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Applets

 
Liza Misra
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I can see my program in appletviewer,but not in a browser (Internet Explorer ).
Can anybody help fixing this?
Liza
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

does your applet do any I/O operations, security stuff
something like that?
also If you can run it in NS, you could check the
Java Console for any exceptions thrown. The Java
Console is avail under Communicator -> Tools menu.
I know IE supports Java console, but not sure how
to get there.
let us know what you find.
regds.
- satya
 
Liza Misra
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satya,
My applet does not do any I/O or Security related stuff.
Is it because there is some thing wrong in coding,in .java or .html file.But in that case I can expect error messages while running in appletviewer,am I right at this point?
I could not follow your instructions properly and so could not find java console in Netscape.It will be a great help if you could explain it a bit more elaborately.
Thanks
Liza
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I could not follow your instructions properly and so could not find java console in Netscape.It
will be a great help if you could explain it a bit more elaborately.

I am assuming you have a html file which loads the applet
(the .class file), ofcourse. So when you load the html file
in a NS browser, the applet is instantiated. During this if
your java code throws any exceptions, then you can see them
in a seperate window called a Java Console.
Load your html file in the NS browser. To open a Java Console,
goto the Communicator menu (next to Go menu) on the browser.
In this menu you should find a Tools Menu Item. If you goto this,
you will find a sun-menu which will cotain the Java Console
menu Item. Select this and it open another window.
If there are any exceptions in your java code, you can see
them here.
Try it out.
- satya
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liza,
It depends what version of Internet Explorer you have, but you can access the java console in my version ( IE 4 ) by clicking menu item View and choosing Internet Options.... Choose the Advanced tab from the resulting window, and scroll down to the Microsoft VM entry. Make sure the Java Console Enabled checkbox has a check in it. ( It says that it requires a restart, but only of IE, not of Windows. ) Then, when you go into the View menu again ( after restarting IE ), there will be a new Java Console option. Choosing this will pop up a window with errors and other information in it.
The most possible cause of your problem is that the VM in IE is pretty old ( ~Java v.1.1 ), so alot of things like Swing, collection classes, etc. are not recognized by the IE VM... look at the error messages you get in the Java Console and see exactly what the problem is.
HTH,
-Nate
 
Liza Misra
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Satya and Nathan,
Thanks for your guidance.
I can now see my Java Console in IE(mine is version 4 too).
The error comes as:
java.lang.ClassNotFoundException: javax.swing.JApplet
at com/ms/vm/loader/URLClassLoader.loadClass
at java/lang/ClassLoader.loadClassInternal
at java/lang/ClassLoader.resolveClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/vm/loader/URLClassLoader.loadClass
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.processSentEvent
at com/ms/applet/AppletPanel.run
at java/lang/Thread.run
But I do have the stmt import javax.swing.*;
& import javax.swing.JApplet.* in my prog.
My .java file has just a JTable display.
I am attaching a code fragment here .

Please advice.
Thanks
Liza
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nate:
Thanks for the tip on IE. In IE 5.0 + the Java Console
is under View menu. I knew it just now.
Lisa:
Also, as suggested by Nate, if your IE browser is old
you can't use Swing. Try upgrading to a newer version.
IE 5.5 or NS 6.0 I guess are the latest. Swing requires
your browser JVM to support Java 2.
Your applet works in appletviewer because appletviewer is in JVM and your JVM obviously has swing support.
Other alternative is to use a plugin, not sure how to do this though!
Other suggestions are welcome......
regds.
- satya
[This message has been edited by Madhav Lakkapragada (edited March 30, 2001).]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The plug-in is avaiable from sun here:
http://java.sun.com/products/plugin/
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic