This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Applets and the fly likes Applet with custom classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet with custom classes" Watch "Applet with custom classes" New topic

Applet with custom classes

Kevin Sullivan

Joined: Jun 19, 2002
Posts: 7
Im trying to run a swing applet running on Weblogic Server 6.0.
Ive set up the environment correct, I believe, because i can run simple swing applets (one file applet with a JLabel on it with text). However, when i try and run a complicated applet (multiple class files with custom classes) i get a "applet not initialized" error. The applet does run correctly through the "AppletViewer" so i believe the code is correct.
I just wonder if anyone has an idea on why this wouldn't work, with what i believe to be the problem -- My custom JPanel classes which i instaniate and add from my JApplet class.
Heres my APPLET TAG:
<TITLE>Service Order</TITLE>
<OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 700
HEIGHT = 550
<PARAM NAME = CODE VALUE = "com.cambrian.serviceorder.applet.ServiceOrderApplet.class">
<PARAM NAME=CODEBASE VALUE="/classes/ServiceOrderENT@ServiceOrderWEB/">
<PARAM NAME = ARCHIVE VALUE = "ServiceOrder.jar">
<PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
<PARAM NAME="scriptable" VALUE="false">
<EMBED type="application/x-java-applet;version=1.3"
CODE = "com.cambrian.serviceorder.applet.ServiceOrderApplet.class"
CODEBASE = "/classes/ServiceOrderENT@ServiceOrderWEB/"
ARCHIVE = "ServiceOrder.jar"
WIDTH = 700
HEIGHT = 550
pluginspage=" ll.html";>
alt="Your browser understands the <APPLET>
tag but isn't running the applet, for some reason.
"Your browser is completely ignoring the <APPLET> tag!
Kevin Sullivan

Joined: Jun 19, 2002
Posts: 7
Ok after some trial and error I've limited it down to the problem.
First the source of the error is in the use of an ImageIcon object. In testing i gave it a relative URL to the current working directory. And it worked great in the applet viewer. I had heard that in order to use it in an applet it needs to be located in the classpath which is was but that doesnt seem to be working through the browser. So, i loaded the image on to an IIS server and put the URL for the ImageIcon to a fully qualified HTTP URL though this still works great in the "appletviewer" it fails as an applet viewed through IE5+. The IIS is running on a different box so i dont know if its a permission thing with the applet or what.
Thanks for any help.
Kevin Sullivan

Joined: Jun 19, 2002
Posts: 7
Well for those of you following this thread.. and judging by the haven't, its come full cycle.
Once i found it was the ImageIcon causing the problem i did a search and found this thread which was most helpful and now my complex applet works correctly.
As a side note i just wanted to say this forum might not have the most talkative bunch but hell it let me think out loud and work through my problem ;-)
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
I've been following your posts. And I conscientiously decided to give it a day before jumping in the pool of trial-and-error with you. JavaRanchers figure out their own problems a lot - we're a bright group. Thanks for sharing your problem and its solution.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: Applet with custom classes
It's not a secret anymore!