This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet with custom classes" Watch "Applet with custom classes" New topic
Author

Applet with custom classes

Kevin Sullivan
Greenhorn

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:
<HTML>
<HEAD>
<TITLE>Service Order</TITLE>
</HEAD>
<BODY>
<OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
WIDTH = 700
HEIGHT = 550
CODEBASE="http://java.sun.com/products/plugin/1.3/jinstall-13-win 32.cab#Version=1,3,0,0">
<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">
<COMMENT>
<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
scriptable=false
pluginspage="http://java.sun.com/products/plugin/1.3/plugin-insta ll.html";>
<NOEMBED>
</COMMENT>
alt="Your browser understands the <APPLET>
tag but isn't running the applet, for some reason.
"Your browser is completely ignoring the <APPLET> tag!
</NOEMBED>
</EMBED>
</OBJECT>
</BODY>
</HTML>
Kevin Sullivan
Greenhorn

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
Kevin Sullivan
Greenhorn

Joined: Jun 19, 2002
Posts: 7
Well for those of you following this thread.. and judging by the replies...you haven't, its come full cycle.
Once i found it was the ImageIcon causing the problem i did a search and found this thread http://www.coderanch.com/t/254146/Applets/java/class-getResource-applet 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
Sheriff

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: http://aspose.com/file-tools
 
subject: Applet with custom classes
 
Similar Threads
OBJECT tag for applets.....
JApplets in IE
JApplets again
Swing Applets in IE
plugin download problem in applet using swing