• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

Swing Applets

Hello to everyone,
I'm new to swing and I have problems running swing applets. When I open the
browser I get an 'class not found' error. Do I have to declare a
classpath? But in this case, how can other people see my applets over the
internet?

Thanks
0
kkarnez
Asked:
kkarnez
1 Solution
 
diakovCommented:
Copy the swingall.jar to the directory of your applet. Add it as a value in the archive entry of the applet tag. Like this:

<APPLET CODE=MyApplet ARCHIVE=mycode.zip,swingall.jar width=300 height=300>

where mycode.zip is the archive of the swing applet.

Cheers,
  Nik
0
 
vladi21Commented:
look!
java Faq:

  (Sect. 11) How can I run Swing technology-based code in a browser?
   Most current browsers have to be specifically set up to run Swing applets.
  Read the article at
  http://java.sun.com/products/jfc/tsc/web/applets/applets.html for information
  about this. The article also contains a simple Swing example applet, so you
  can confirm that that's your problem.
  Another approach is to use the Java plug-in, which automatically gives Swing
  technology in the browser. See
  http://java.sun.com/products/jfc/tsc/swingdoc-current/java_plug_in.html 
  http://java.sun.com/products/plugin
  http://developer.java.sun.com/developer/onlineTraining/Programming/JDCBook/win.html

  HTML Converter Features
  http://java.sun.com/products/plugin/1.2/features.html
 


---
Make Swing always available from Netscape
To be able use Swing classes (without download delay) from Netscape, copy Swing JAR files (swingall.jar) in the PLUGINS directory and restart Netscape. This Ok with pre-Java 2 Swing. With that version you need the Java plug-in to be able to use the swing classes.
--
Detect which version of Swing is installed
http://www.codeguru.com/java/articles/566.shtml


Running Swing Applets
http://java.sun.com/docs/books/tutorial/uiswing/start/swingApplet.html

-----
No, swing is not a part of JRE1.1.x. you can download the swing package sepertaley from http://java.sun.com 
i.e swingall.jar package that contains all the swing classes.

there r the options for u,
1. Install SWING(put swingall.jar in the users classpath) in the clients machine

2. Install JRE2 (with Java Plug-in enabled) on the users machine & invoke ur applet using the plg-in. you need to use <OBJECT> & <EMBED> tags to do this. chk out the HTMLConvertor available at http://java.sun.com . This HTMLConvertor will convert ur HTML file to include <OBJECT> & <EMBED> tags

3.Include <APPLET CODE="mySwingApplet" ARCHIVE="swingall.jar" WIDTH=300 HEIGHT=300></APPLET>
the archive swingall.jar. 'cos of this every time ur applet is loaded swingall.jar gets downloaded to the users machine. This makes the whole process very slow 'cos swingall.jar file's size is i the range of 2.5mb.
But you can include only classes used by your applet.(try make it witj JAX. JAX reads class files, analyzes them, and generates a compressed ZIP file as output
http://www.alphaworks.ibm.com/formula/JAX)


0
 
vishwanathnCommented:
Have you go the plugin for swing applets.

what is the browser you use?

You need to convert your html file witht he embed tag so that the plugin gets invoked.
0
 
kkarnezAuthor Commented:
Sorry vladi21, by a mistake I didn't give you the points. Answer the 'foo question' and the 50 points are yours...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now