jQuery in Action, 2nd edition*
The moose likes Java in General and the fly likes Problem with Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Problem with Applets " Watch "Problem with Applets " New topic
Author

Problem with Applets

Liza Misra
Ranch Hand

Joined: Mar 26, 2001
Posts: 32
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

Joined: Jun 03, 2000
Posts: 5040

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

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
Liza Misra
Ranch Hand

Joined: Mar 26, 2001
Posts: 32
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

Joined: Jun 03, 2000
Posts: 5040
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

Joined: Oct 18, 2000
Posts: 4121

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


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Liza Misra
Ranch Hand

Joined: Mar 26, 2001
Posts: 32
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

Joined: Jun 03, 2000
Posts: 5040
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

Joined: Sep 29, 2000
Posts: 8521
The plug-in is avaiable from sun here:
http://java.sun.com/products/plugin/


"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem with Applets
 
Similar Threads
Can the color for the disabled item be changed
WA #1.....word association
Private methods
URGENT - NEED HELP - Block Code
error in Marcus Green 2.