Visual Cafe

Ok: I'm using Visual Cafe to develop a small applet.  I am trying to deploy the applet to have the files that I need.  I am doing this with two .jar files: one that Visual Cafe packages for me and the other is "swingall.jar", used for the swing components in my applet.  I am trying to test the applet with the following html:
<HTML>
<HEAD>
<TITLE>Test HTML</TITLE>
</HEAD>
<BODY>
<APPLET CODE="UIMenu.class" WIDTH=658 HEIGHT=582   ARCHIVE="Prototype.jar,swingall.jar"></APPLET>
</BODY>
</HTML>

First: it loads, but says that there is an error running the UIMenu class (the applet).  It runs fine in the VisualCafe environment, so I think the problem may be in the area of using the jar files (maybe?).  

Is there anything wrong with the above code?  What application should Netscape use to handle the jar files, if any?  Any help would be greatly appreciated.

Laminamia
LVL 3
Laminamia063099Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JodCommented:
Note that some versioons of netscape (before 4.5) only load the first Jar file when there is more than one. Details of this bug below:

Also note that you may not need to include swingall.jar - just swing.jar which is much smaller for distribution. swingall.jar has development stuff in that you do not need for just running the applet.

As a test, try to download swingall.jar into the CLASSPATH on the local client and remove it from the applet tag. If it then, works you know the above is true.

There are some more details here in one of my previous answers...

http://www.experts-exchange.com/jsp/qShow.jsp?ta=java&qid=10215402 
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JodCommented:
To save you the points of looking there, here is some of the key text copied from the above answer:


There are a number of links below to help:

http://java.sun.com/products/jfc/tsc/web/applets/applets.html 

http://butler.physik.uni-mainz.de/webdoc/java_tutorial/uiswing/start/swingStart11.html 

http://www.javaworld.com/jw-07-1998/jw-07-jar.html 

In general, which browser are you using? Have you tried running the applet in the JRE? Eg:

jre -cp .;c:\jre1.1.6\lib\rt.jar;c:\jre1.1.6\swingall.jar YourClassName

or in general:

jre -cp .;c:\jre1.1.6\lib\rt.jar;<path to your swinall>swingall.jar YourClassName

or even a silly fix, which is change your html to:

<applet code="TT" archive="swingall.jar"  height=500 width=500></applet> (also see IE hint below)

It seems that if your .class files are in a ZIPed or JARed file then add the ZIPed or JARed filename to the path specifically, as opposed to including just the DIR.

Perhaps try downloading swingall.jar to the relevant client machine and enter it into the relevant class path. Details are given in the above links.


An important point to note from the above links is:

Even after you've upgraded your browser to use Swing, you still may encounter a few problems that haven't been quite ironed out yet. For example:

When there are multiple archive files, Netscape Communicator loads only the first one. So, when Netscape has unarchived the swing.jar file, it may ignore the look-and-feel JAR files, blocking their use in applets.

Although Internet Explorer recognizes both class files and archive (JAR)  files when you specify both types in an APPLET tag definition, it refuses to use both kinds of files at the same time. To work around this problem, use the jar command to  convert any class commands that you use in your applets to JAR files.  Then you can list the names of both Swing's JAR files and your own JAR  files in the same APPLET tag definition.

Finally, try to use swing.jar, windows.jar instead of swingall.jar. swingall.jar is a very large download so is to be avoided if possible as it contains lots of development stuff that you don't need to run the applet.
0
Laminamia063099Author Commented:
Thanks, I've got it working by un-jarring all of the archives.  It is only a temporary fix (using the classes without them being archived) but I will look into the info that you've provided here as well.

What is the benefit (if there is one) of using jars over providing the class files themselves?

laminamia
0
JodCommented:
Jar files in general package up all your classes into one archive file that is easy to distribute, compacted and the jar file can be signed etc...

If you want to know more, look here:

http://www.javaworld.com/jw-07-1998/jw-07-jar.html
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.