Solved

Swing Applets

Posted on 2000-02-29
4
340 Views
Last Modified: 2013-12-29
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
Comment
Question by:kkarnez
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Expert Comment

by:diakov
ID: 2568549
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
 
LVL 7

Expert Comment

by:vladi21
ID: 2568576
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
 

Accepted Solution

by:
vishwanathn earned 50 total points
ID: 2573248
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
 

Author Comment

by:kkarnez
ID: 2574053
Sorry vladi21, by a mistake I didn't give you the points. Answer the 'foo question' and the 50 points are yours...
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

628 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