[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Visual Cafe

Posted on 1999-11-04
4
Medium Priority
?
382 Views
Last Modified: 2013-11-23
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
0
Comment
Question by:Laminamia063099
  • 3
4 Comments
 
LVL 5

Accepted Solution

by:
Jod earned 400 total points
ID: 2184717
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
 
LVL 5

Expert Comment

by:Jod
ID: 2184722
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
 
LVL 3

Author Comment

by:Laminamia063099
ID: 2184978
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
 
LVL 5

Expert Comment

by:Jod
ID: 2184995
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month9 days, 11 hours left to enroll

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question