Questions tagged [applet]

Applet means 'small application'. This has become commonly used to describe Java applets embedded in web pages. And in that context, applets can be regarded as outdated technology.

Applet

Applet means 'small application'. This term has become commonly used to describe Java applets embedded in web pages - to the extent that the HTML based applet element is for embedding Java applets.

That being said:

  • An applet does not need to be embedded in a web page
  • An applet does not need to be written in Java
  • Many embedded Java applets are not 'small'

Gradually this term is being dragged back to its original meaning. In the more general sense, it might be applied to (for example) operating system settings or configuration applets. Such OS specific applets would typically not be written using Java.

Having covered the general meaning, and recognizing that the common usage of 'applet' is still 'Java applet', the rest of this entry will focus on Java applets.


Java Applet

Looking from the specific Java applet context, it is important to understand that no modern browser is supporting Java plugins any more; and therefore Java applets are not supported any more, too! This means: Java applets can be seen as a product that has reached "end of life"; it should not be used any more when developing new products; applets are only relevant in the sense of "how to migrate away" from them.

Java applets are applications written using the Java programming language that are embedded in web pages. Applets typically provide dynamic functionality that is not supported by plain HTML or a combination of HTML and JavaScript.

Perhaps ironically, the functionality of JavaScript is sometimes invoked from Java applets to achieve things that applets cannot do on their own. Further, the deployJava.js JavaScript provided by Oracle is designed to launch applets after checking a suitable minimum Java version is installed. While Java can do things that JavaScript cannot - most modern applets would not get very far if JavaScript was disabled in the user's browser!

Many 'beginner books' on Java seem to rush into applet development in early stages in the book. This is a huge mistake. Any text that does so should be considered suspect.

While applets might seem easy to develop, they are actually quite tricky. To deploy an applet reliably to 'all comers' (or at least the vast majority) on the WWW is an order of magnitude more difficult again. For more details See Why CS teachers should stop teaching Java applets, a blog entry by the top ranked provider of answers for the applet tag.

The Java applet API provides methods considered handy to web based applications. These include methods to gain images and audio clips, discover and communicate with other applets, ascertain the code base and document base (where am I?) to allow relative references to resources (images, clips, text files, etc.) that the applet might use.

Applets could be embedded in web pages since Java 1.1. With Java 1.2 came Java Web Start, which could launch both applications and applets as free floating entities (not embedded in a web page). With the release of Java 1.6.0_10, applets could remain embedded in web pages, but they also access the functionality of JWS and services of the JNLP API.

Applet 'Hello World' Example

This example requires the Java Development Kit installed. Visit Java SE Downloads for the latest JDK.

/* <!-- Defines the applet element used by the appletviewer. -->
<applet code='HelloWorld' width='200' height='100'></applet> */
import javax.swing.*;

/** An 'Hello World' Swing based applet.

To compile and launch:
prompt> javac HelloWorld.java
prompt> appletviewer HelloWorld.java  */
public class HelloWorld extends JApplet {

    public void init() {
        // Swing operations need to be performed on the EDT.
        // The Runnable/invokeAndWait(..) ensures that happens.
        Runnable r = new Runnable() {
            public void run() {
                // the crux of this simple applet
                getContentPane().add( new JLabel("Hello World!") );
            }
        };
        SwingUtilities.invokeAndWait(r);
    }
}

See also

7462 questions
35
votes
1 answer

Warning relied on Caller-Allowable-Codebase attribute not shown always

I have the following manifest information in the signed Java applet. My build environment is old and is currently restricted to JDK 1.6. Manifest-Version: 1.0 Implementation-Vendor: Foo, Inc. Application-Library-Allowable-Codebase: *…
Mahesh
  • 34,573
  • 20
  • 89
  • 115
30
votes
10 answers

Can't read AppletViewer properties file - Applet

I created a Java applet program and compiled it. As a result of the compilation, it generated a class file. But, it showed the following warning message while running the applet with the command prompt using the appletviewer command. …
whiterose
  • 4,391
  • 8
  • 24
  • 18
30
votes
2 answers

OS X 10.8 Gatekeeper and Java applets

With the new release of OS X 10.8, the Gatekeeper will popup the following warning, when you try to start a signed Java applet: The applet has been signed with a valid code signing certificate and will work correctly on other platforms as well as…
Rasmus Faber
  • 48,631
  • 24
  • 141
  • 189
29
votes
6 answers

"application blocked by security settings" prevent applets running using oracle SE 7 update 51 on firefox on Linux mint

Background Complete fresh installation of Oracle Java SDK (32-bit) on Linux. The installation is correct, the plugin is correctly installed. Problem The following error ("Application Blocked by Security Settings") appears when the applet runs inside…
Nasser
  • 12,849
  • 6
  • 52
  • 104
28
votes
7 answers

How to deploy a java applet for today's browsers (applet, embed, object)?

How do i deploy a java applet for modern browsers? I know there are somehow 3 possibilities but nobody tells me which one to prefer and how to use them. Does somebody have any resources on that? i cant find any :(
Michael Siebert
  • 2,378
  • 1
  • 20
  • 17
28
votes
6 answers

Incompatible magic value 1008813135

I am writing a Java applet and embedding it in a web page. It used to run Mac and Windows in different browsers without problem. I was using NetBeans on the Mac to build the .jar file the applet used. For some reason or another I decided to load the…
Warlax
  • 2,459
  • 5
  • 30
  • 41
27
votes
5 answers

How to establish a TCP Socket connection from a web browser (client side)?

I've read about WebSockets but they don't seem to be pure "sockets", because there is an application layer protocol over them. "ws:" Is there any way of doing a pure socket connection from a web browser, to enliven webpages? Here are my random stabs…
Hernán Eche
  • 6,529
  • 12
  • 51
  • 76
27
votes
6 answers

Java Web Start vs Embedded Java Applet

I'm going to deploy my Java game to show it to my friends and whatnot, but I'm having trouble deciding between Java Web Start and applets. Under what conditions is one preferable over another and what advantages/disadvantages are there?
Matthew H
  • 5,831
  • 8
  • 47
  • 82
27
votes
4 answers

Tunnel any kind of TCP traffic through HTTP/s

I am looking for a software to tunnel RDP or other binary TCP traffic through a HTTPS tunnel. Because many clients only have HTTP/S permitted (only port 80 and 443 open in the firewall). But there's a need to forward RDP (and other protocols) from…
GreenRover
  • 1,486
  • 1
  • 14
  • 33
25
votes
3 answers

Cannot get name & email with sign in with Apple on real device

So I'm implementing sign in with Apple, everything goes well on the simulator, I request email, fullName scopes, the authenticate UI shows, and I can get the data, as images shown below: But when testing on real device (iPadOS 13, iPad 2018), the…
Johnny
  • 2,589
  • 2
  • 27
  • 34
25
votes
10 answers

javax.net.ssl.SSLException: Certificate doesn't match any of the subject alternative names

I recently added LetsEncrypt certificates to my server and my java applet is having problems connecting using TLS. My applet uses Apache HttpClient. My web server is Apache 2,4, and I have a few virtual hosts set up as subdomains of my main domain…
yassam
  • 533
  • 1
  • 6
  • 15
23
votes
4 answers

What does the Java Applet security warning "JAR file manifest does not contain the Permissions attribute"mean?

I have a Java Applet which needs access to the local filesystem of the client. I have created a simple certificate for my own (it is NOT certified by Verisign,Commodo, ...). I signed the jar with the following template: del…
koalabruder
  • 2,794
  • 9
  • 33
  • 40
23
votes
2 answers

Processing of multipart/form-data request failed. Read timed out

Other questions on Stack Overflow have addressed this question, but none of the answers provided have helped me to address the issue. I'm trying to upload a file of anywhere between 10 kB to 16 MB from an applet using Apache HTTP Commons. Everything…
Mihir
  • 2,480
  • 7
  • 38
  • 57
22
votes
1 answer

Can you sign a Java applet but keep it in the sandbox (NOT give it full access to user's computer)?

Thanks to Oracle's latest changes, it appears I have to sign an applet even though I don't need or want it to have unrestricted access to the user's computer (which is why its currently unsigned). In particular, I don't want the warning they show…
Garret Harrison
  • 391
  • 3
  • 9
21
votes
12 answers

Warning on Permissions attribute when running an applet with JRE 7u45

I've just upgraded JRE to 7u45, and my applet receives a warning message on start-up, saying " This application will be blocked in a future Java security update because the JAR file manifest does not contain the Permissions attribute." Then I added…
Zhao Yi
  • 2,335
  • 7
  • 23
  • 27