Java applet: Difference between revisions
imported>Jport simplify |
StanislovAI (talk | contribs) correction |
||
| Line 1: | Line 1: | ||
{{Short description|Small application written in Java}} | {{Short description|Small application written in Java}} | ||
[[File:Java applet.png|thumb|A Java applet that was created as supplementary demonstration material for a scientific publication]] | [[File:Java applet.png|thumb|A Java applet that was created as supplementary demonstration material for a scientific publication]] | ||
[[File:OpenAstexViewer.jpg|thumb|A Java applet that uses 3D [[Hardware acceleration|hardware acceleration]] to visualize 3D files in .pdb format downloaded from a server<ref>{{cite web|url= | [[File:OpenAstexViewer.jpg|thumb|A Java applet that uses 3D [[Hardware acceleration|hardware acceleration]] to visualize 3D files in [[Biology:Protein Data Bank (file format)|.pdb format]] downloaded from a server<ref>{{cite web|url=https://openastexviewer.net/web/|title=The home site of the 3D protein viewer (Openastexviewer) under LGPL|access-date=21 September 2009|archive-url=https://web.archive.org/web/20090801135810/http://www.openastexviewer.net/web/|archive-date=1 August 2009|url-status=dead}}</ref>]] | ||
[[File:Cardiac cells applet.png|thumb|120px|Using applet for nontrivial animation illustrating biophysical topic (randomly moving ions pass through voltage gates)<ref name='heart'>{{Cite web|url= | [[File:Cardiac cells applet.png|thumb|120px|Using applet for nontrivial animation illustrating biophysical topic (randomly moving ions pass through voltage gates)<ref name='heart'>{{Cite web|url=https://thevirtualheart.org/CAPindex.html|title=Generation of an action potential in cardiac cells using interactive java applet. Excitable media. movies excitable media Fitzhug nagumo beeler reuter luo rudy model mathematical cell modeling|website=Thevirtualheart.org|access-date=22 March 2022}}</ref>]] | ||
[[File:Mandelbrot java applet.png|thumb|Using a Java applet for computation{{snd}} intensive visualization of the [[ | [[File:Mandelbrot java applet.png|thumb|Using a Java applet for computation{{snd}} intensive visualization of the [[Mandelbrot set]]<ref>{{cite web|url=http://math.uchicago.edu/~dannyc/fractals/simple.html|title=The home site of the Mandelbrot set applet under GPL|access-date=29 July 2013|archive-url=https://web.archive.org/web/20130508054436/http://math.uchicago.edu/~dannyc/fractals/simple.html|archive-date=8 May 2013|url-status=dead}}</ref>]] | ||
[[File:ChessApplet.png|thumb|Applets' running speed is sufficient for making e.g. nontrivial computer games that play chess.<ref>{{cite web|url=http://english.op.org/~peter/ChessApp/ |title=The home site of the chess applet under BSD |url-status=dead |archive-url=https://web.archive.org/web/20090907072956/http://english.op.org/~peter/ChessApp/ |archive-date= 7 September 2009 }}</ref>]] | [[File:ChessApplet.png|thumb|Applets' running speed is sufficient for making e.g. nontrivial computer games that play [[chess]].<ref>{{cite web|url=http://english.op.org/~peter/ChessApp/ |title=The home site of the chess applet under BSD |url-status=dead |archive-url=https://web.archive.org/web/20090907072956/http://english.op.org/~peter/ChessApp/ |archive-date= 7 September 2009 }}</ref>]] | ||
[[File:NASA World Wind.jpg|thumb|NASA World Wind (open source) is a second generation applet<ref>{{Cite web |url=http://java.sun.com/developer/technicalArticles/javase/newapplets/ |title=Next Generation in Applet Java Plug-in Technology |access-date=25 September 2009 |archive-date=4 April 2009 |archive-url=https://web.archive.org/web/20090404094007/http://java.sun.com/developer/technicalArticles/javase/newapplets/ |url-status=dead }}</ref> that makes heavy use of OpenGL and on-demand data downloading to provide a detailed 3D map of the world.]] | [[File:NASA World Wind.jpg|thumb|NASA [[World Wind]] (open source) is a second generation applet<ref>{{Cite web |url=http://java.sun.com/developer/technicalArticles/javase/newapplets/ |title=Next Generation in Applet Java Plug-in Technology |access-date=25 September 2009 |archive-date=4 April 2009 |archive-url=https://web.archive.org/web/20090404094007/http://java.sun.com/developer/technicalArticles/javase/newapplets/ |url-status=dead }}</ref> that makes heavy use of [[Software:OpenGL|OpenGL]] and on-demand data downloading to provide a detailed 3D map of the world.]] | ||
[[File:Remoteconsoleapplet.png|thumb|Web [[ | [[File:Remoteconsoleapplet.png|thumb|Web [[out-of-band management|access]] to the server console at the hardware level with the help of a Java applet]] | ||
[[File:FFT2DApplet.png|thumb|Demonstration of image processing using two dimensional [[ | [[File:FFT2DApplet.png|thumb|Demonstration of image processing using two dimensional [[Fourier transform]] ]] | ||
'''Java applets''' | '''Java applets''' are [[Software:Applet|small applications]] written in the [[Java (programming language)|Java]] programming language, or another [[Programming language|programming language]] that [[Compiled language|compiles]] to [[Java bytecode]], and delivered to users in the form of Java [[Software:Bytecode|bytecode]]. | ||
At the time of their introduction, the intended use was for the user to launch the applet from a [[Web page|web page]], and for the applet to then execute within a [[Java virtual machine]] (JVM) in a [[Process (computing)|process]] separate from the [[Software:Web browser|web browser]] itself. A Java applet could appear in a frame of the web page, a new application window, a program from [[Company:Sun Microsystems|Sun]] called appletviewer,<ref>{{Cite web |title=appletviewer — Java SE 8 |url=https://docs.oracle.com/javase/8/docs/technotes/tools/windows/appletviewer.html |access-date=December 5, 2023 |publisher=Oracle}}</ref> or a stand-alone tool for testing applets.{{What?|date=December 2023|reason=A standalone tool like what?}} | |||
Java applets were | Java applets were introduced in the first version of the Java language, which was released in 1995. Beginning in 2013, major web browsers began to phase out support for [[NPAPI#Support/deprecation|NPAPI]], the underlying technology applets used to run. with applets becoming completely unable to be run by 2015–2017. Java applets were [[Deprecation|deprecated]] by Java 9 in 2017.<ref>{{cite web|url=https://www.oracle.com/technetwork/java/javase/9-deprecated-features-3745636.html|title=Java 9 Release Notes|website=Oracle.com}}</ref><ref>{{Cite web|url=https://openjdk.java.net/jeps/289|title=JEP 289: Deprecate the Applet API|website=Openjdk.java.net|access-date=22 March 2022}}</ref><ref>{{cite web|url=https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free|title=JPG blog: Moving to a Plugin-Free Web|website=Blogs.oracle.com}}</ref><ref>{{cite web|url=https://blogs.oracle.com/java-platform-group/entry/further_updates_to_moving_to|title=JPG blog: Further Updates to 'Moving to a Plugin-Free Web'|website=Blogs.oracle.com}}</ref><ref>{{cite web|url=https://www.oracle.com/technetwork/java/javase/javaclientroadmapupdate2018mar-4414431.pdf|title=Java Client Roadmap Update|website=Oracle.com|access-date=22 March 2022}}</ref> Java applets were ''deprecated for removal'' by Java 17 in 2021.<ref>{{Cite web |orig-date=2024-12-04 |title=JEP 398: Deprecate the Applet API for Removal |url=https://openjdk.org/jeps/398 |access-date=2025-10-31 |website=openjdk.org}}</ref> Java applets are targeted to be removed by Java 26 in 2026.<ref>{{Cite web |title=JEP 504: Remove the Applet API |url=https://openjdk.org/jeps/504 |access-date=2025-10-31 |website=openjdk.org}}</ref> | ||
Java applets | Java applets were usually written in Java, but other languages such as [[Tutorial:Jython|Jython]], [[Software:JRuby|JRuby]], [[Pascal (programming language)|Pascal]],<ref>{{Cite web|url=https://wiki.freepascal.org/FPC_JVM|title=FPC JVM – Free Pascal wiki|website=Wiki.freepascal.org|access-date=22 March 2022}}</ref> [[Scala (programming language)|Scala]], [[NetRexx]], or [[Eiffel (programming language)|Eiffel]] (via [[SmartEiffel]]) could be used as well. | ||
Since Java bytecode is cross-platform (or platform independent), Java applets could be executed by [[Client (computing)|client]]s for many platforms, including [[Software:Microsoft Windows|Microsoft Windows]], [[Software:FreeBSD|FreeBSD]], [[Software:Unix|Unix]], [[Software:MacOS|macOS]] and [[Software:Linux|Linux]]. They could not be run on mobile devices, which do not support running standard Oracle JVM bytecode. [[Software:Android (operating system)|Android]] devices can run code written in Java compiled for the [[Software:Android Runtime|Android Runtime]]. | Unlike early versions of JavaScript, Java applets had access to 3D [[Hardware acceleration|hardware acceleration]], making them well-suited for non-trivial, computation-intensive visualizations. Since applets' introduction, JavaScript has gained support for hardware-accelerated graphics via [[Canvas element|canvas]] technology (or specifically [[Software:WebGL|WebGL]], then later [[WebGPU]] in the case of 3D graphics),<ref>{{cite web |url=https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#Browser_compatibility|title=canvas – HTML|publisher=Mozilla Developer Network|access-date=15 August 2015}}</ref><ref>{{cite web |url= https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API#Browser_compatibility|title=WebGL – Web API Interfaces|publisher=Mozilla Developer Network|access-date=15 August 2015}}</ref> as well as [[Just-in-time compilation|just-in-time compilation]].<ref>{{cite web|url=https://developers.google.com/v8/design?hl=en|title=Design Elements – Chrome V8|access-date=15 August 2015}}</ref> | ||
Since Java bytecode is [[Cross-platform|cross-platform]] (or platform independent), Java applets could be executed by [[Client (computing)|client]]s for many platforms, including [[Software:Microsoft Windows|Microsoft Windows]], [[Software:FreeBSD|FreeBSD]], [[Software:Unix|Unix]], [[Software:MacOS|macOS]] and [[Software:Linux|Linux]]. They could not be run on mobile devices, which do not support running standard Oracle JVM bytecode. [[Software:Android (operating system)|Android]] devices can run code written in Java compiled for the [[Software:Android Runtime|Android Runtime]]. | |||
== Overview == | == Overview == | ||
| Line 40: | Line 42: | ||
== Embedding into a web page == | == Embedding into a web page == | ||
The applet would be displayed on the web page by making use of the deprecated <code>applet</code> HTML element,<ref>{{Cite web|url= | The applet would be displayed on the web page by making use of the deprecated <code>applet</code> HTML element,<ref>{{Cite web|url=https://www.w3.org/TR/html401/struct/objects.html#edef-APPLET|title=Objects, Images, and Applets in HTML documents|website=W3.org|access-date=22 March 2022}}</ref> or the recommended <code>object</code> element.<ref>{{Cite web|url=https://www.w3.org/TR/html401/struct/objects.html#edef-OBJECT|title=Objects, Images, and Applets in HTML documents|website=W3.org|access-date=22 March 2022}}</ref> The <code>embed</code> element can be used<ref name="java">{{cite web|url=http://www.java.com/en/download/manual.jsp |title=Java Downloads for All Operating Systems |publisher=Java.com |date=14 August 2012 |access-date=2013-06-14}}</ref> with Mozilla family browsers (<code>embed</code> was deprecated in HTML 4 but is included in HTML 5). This specifies the applet's source and location. Both <code>object</code> and <code>embed</code> tags can also download and install Java virtual machine (if required) or at least lead to the plugin page. <code>applet</code> and <code>object</code> tags also support loading of the serialized applets that start in some particular (rather than initial) state. Tags also specify the message that shows up in place of the applet if the browser cannot run it due to any reason. | ||
However, despite <code>object</code> being officially a recommended tag in 2010, the support of the <code>object</code> tag was not yet consistent among browsers and Sun kept recommending the older <code>applet</code> tag for deploying in multibrowser environments,<ref name="ja">{{Cite web |url=http://download.java.net/jdk7/docs/technotes/guides/plugin/developer_guide/using_tags.html#object |title=Sun's position on applet and object tags |access-date=14 January 2010 |archive-url=https://web.archive.org/web/20100609015456/http://download.java.net/jdk7/docs/technotes/guides/plugin/developer_guide/using_tags.html#object |archive-date=9 June 2010 |url-status=dead }}</ref> as it remained the only tag consistently supported by the most popular browsers. To support multiple browsers, using the <code>object</code> tag to embed an applet would require JavaScript (that recognizes the browser and adjusts the tag), usage of additional browser-specific tags or delivering adapted output from the server side. | However, despite <code>object</code> being officially a recommended tag in 2010, the support of the <code>object</code> tag was not yet consistent among browsers and Sun kept recommending the older <code>applet</code> tag for deploying in multibrowser environments,<ref name="ja">{{Cite web |url=http://download.java.net/jdk7/docs/technotes/guides/plugin/developer_guide/using_tags.html#object |title=Sun's position on applet and object tags |access-date=14 January 2010 |archive-url=https://web.archive.org/web/20100609015456/http://download.java.net/jdk7/docs/technotes/guides/plugin/developer_guide/using_tags.html#object |archive-date=9 June 2010 |url-status=dead }}</ref> as it remained the only tag consistently supported by the most popular browsers. To support multiple browsers, using the <code>object</code> tag to embed an applet would require JavaScript (that recognizes the browser and adjusts the tag), usage of additional browser-specific tags or delivering adapted output from the server side. | ||
| Line 47: | Line 49: | ||
== Advantages == | == Advantages == | ||
A Java applet could have any or all of the following advantages:<ref>[ | A Java applet could have any or all of the following advantages:<ref>[https://download.oracle.com/javase/tutorial/deployment/applet/index.html Oracle official] overview on Java applet technology</ref> | ||
* It was simple to make it work on FreeBSD, Linux, Microsoft Windows and macOS{{snd}} that is, to make it cross-platform. Applets were supported by most [[Software:Web browser|web browser]]s through the first decade of the 21st century; since then, however, most browsers have dropped applet support for security reasons. | * It was simple to make it work on FreeBSD, Linux, Microsoft Windows and macOS{{snd}} that is, to make it cross-platform. Applets were supported by most [[Software:Web browser|web browser]]s through the first decade of the 21st century; since then, however, most browsers have dropped applet support for security reasons. | ||
| Line 53: | Line 55: | ||
* Most web browsers [[Web cache|cached]] applets so they were quick to load when returning to a web page. Applets also improved with use: after a first applet is run, the JVM was already running and subsequent applets started quickly (the JVM will need to restart each time the browser starts afresh). JRE versions 1.5 and greater restarted the JVM when the browser navigates between pages, as a security measure which removed that performance gain. | * Most web browsers [[Web cache|cached]] applets so they were quick to load when returning to a web page. Applets also improved with use: after a first applet is run, the JVM was already running and subsequent applets started quickly (the JVM will need to restart each time the browser starts afresh). JRE versions 1.5 and greater restarted the JVM when the browser navigates between pages, as a security measure which removed that performance gain. | ||
* It moved work from the [[Server (computing)|server]] to the [[Client (computing)|client]], making a web solution more scalable with the number of users/clients. | * It moved work from the [[Server (computing)|server]] to the [[Client (computing)|client]], making a web solution more scalable with the number of users/clients. | ||
* If a standalone program (like [[ | * If a standalone program (like [[Astronomy:Google Earth|Google Earth]]) talks to a web server, that server normally needs to support all prior versions for users who have not kept their client software updated. In contrast, a browser loaded (and cached) the latest applet version, so there is no need to support legacy versions. | ||
* Applet naturally supported changing user state, such as figure positions on the chessboard. | * Applet naturally supported changing user state, such as figure positions on the chessboard. | ||
* Developers could develop and debug an applet directly simply by creating a main routine (either in the applet's class or in a separate class) and calling init() and start() on the applet, thus allowing for development in their favorite [[Java Platform, Standard Edition|Java SE]] development environment. All one had to do was to re-test the applet in the AppletViewer program or a web browser to ensure it conforms to security restrictions. | * Developers could develop and debug an applet directly simply by creating a main routine (either in the applet's class or in a separate class) and calling init() and start() on the applet, thus allowing for development in their favorite [[Java Platform, Standard Edition|Java SE]] development environment. All one had to do was to re-test the applet in the AppletViewer program or a web browser to ensure it conforms to security restrictions. | ||
| Line 80: | Line 82: | ||
== Security == | == Security == | ||
{{POV section|date=November 2021}} | {{POV section|date=November 2021}} | ||
There were two applet types with very different security models: signed applets and unsigned applets.<ref>{{Cite web|url=https://docs.oracle.com/javase/tutorial/deployment/applet/security.html|title=What Applets Can and Cannot Do (The | There were two applet types with very different security models: signed applets and unsigned applets.<ref>{{Cite web|url=https://docs.oracle.com/javase/tutorial/deployment/applet/security.html|title=What Applets Can and Cannot Do (The Java Tutorials > Deployment > Java Applets)|website=Docs.oracle.com|access-date=22 March 2022}}</ref> Starting with Java SE 7 Update 21 (April 2013) applets and Web-Start Apps are encouraged to be signed with a trusted certificate, and warning messages appear when running unsigned applets.<ref>{{Cite web|url = https://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html#60|title = Java Applet & Web Start – Code Signing|access-date = 28 February 2014|publisher = Oracle}}</ref> Further, starting with Java 7 Update 51 unsigned applets were blocked by default; they could be run by creating an exception in the Java Control Panel.<ref>{{Cite web|url = http://java.com/en/download/help/appsecuritydialogs.xml|title = What should I do when I see a security prompt from Java?|access-date = 28 February 2014|publisher = Oracle}}</ref> | ||
=== Unsigned ===<!-- I didn't really bother with cleaning up the tense of these sections: they need a full rewrite, due to substantial NPOV problems --> | === Unsigned ===<!-- I didn't really bother with cleaning up the tense of these sections: they need a full rewrite, due to substantial NPOV problems --> | ||
Limits on unsigned applets were understood as "draconian": they have no access to the local filesystem and web access limited to the applet download site; there are also many other important restrictions. For instance, they cannot access all system properties, use their own class loader, call native code, execute external commands on a local system or redefine classes belonging to core packages included as part of a Java release. While they can run in a standalone frame, such frame contains a header, indicating that this is an untrusted applet. Successful initial call of the forbidden method does not automatically create a security hole as an access controller checks the entire [[Call stack|stack]] of the calling code to be sure the call is not coming from an improper location. | Limits on unsigned applets were understood as "draconian": they have no access to the local filesystem and web access limited to the applet download site; there are also many other important restrictions. For instance, they cannot access all system properties, use their own class loader, call native code, execute external commands on a local system or redefine classes belonging to core packages included as part of a Java release. While they can run in a standalone frame, such frame contains a header, indicating that this is an untrusted applet. Successful initial call of the forbidden method does not automatically create a security hole as an access controller checks the entire [[Call stack|stack]] of the calling code to be sure the call is not coming from an improper location. | ||
Some studies mention applets crashing the browser or overusing [[Central processing unit|CPU]] resources but these are classified as nuisances and not as true security flaws. However, unsigned applets may be involved in combined attacks that exploit a combination of multiple severe configuration errors in other parts of the system. An unsigned applet can also be more dangerous to run directly on the server where it is hosted because while code base allows it to talk with the server, running inside it can bypass the firewall. An applet may also try [[Denial-of-service attack|DoS attacks]] on the server where it is hosted, but usually people who manage the web site also manage the applet, making this unreasonable. Communities may solve this problem via [[Code review|source code review]] or running applets on a dedicated domain. | Some studies mention applets crashing the browser or overusing [[Central processing unit|CPU]] resources but these are classified as nuisances and not as true security flaws. However, unsigned applets may be involved in combined attacks that exploit a combination of multiple severe configuration errors in other parts of the system. An unsigned applet can also be more dangerous to run directly on the server where it is hosted because while code base allows it to talk with the server, running inside it can bypass the firewall. An applet may also try [[Denial-of-service attack|DoS attacks]] on the server where it is hosted, but usually people who manage the web site also manage the applet, making this unreasonable. Communities may solve this problem via [[Code review|source code review]] or running applets on a dedicated domain. | ||
The unsigned applet can also try to download malware hosted on originating server. However it could only store such file into a temporary folder (as it is transient data) and has no means to complete the attack by executing it. There were attempts to use applets for spreading Phoenix and Siberia exploits this way, | The unsigned applet can also try to download malware hosted on originating server. However it could only store such file into a temporary folder (as it is transient data) and has no means to complete the attack by executing it. There were attempts to use applets for spreading Phoenix and Siberia exploits this way, but these exploits do not use Java internally and were also distributed in several other ways. | ||
=== Signed === | === Signed === | ||
A signed applet<ref>{{Cite web|url=https://www.informit.com/articles/article.aspx?p=433382&seqNum=2|title=Java Applet Security | A signed applet<ref>{{Cite web|url=https://www.informit.com/articles/article.aspx?p=433382&seqNum=2|title=Java Applet Security {{pipe}} Java 2 Platform Security {{pipe}} InformIT|website=Informit.com|access-date=22 March 2022}}</ref> contains a signature that the browser should verify through a remotely running, independent [[Certificate server|certificate authority server]]. Producing this signature involves specialized tools and interaction with the authority server maintainers. Once the signature is verified, and the user of the current machine also approves, a signed applet can get more rights, becoming equivalent to an ordinary standalone program. The rationale is that the author of the applet is now known and will be responsible for any deliberate damage. This approach allows applets to be used for many tasks that are otherwise not possible by client-side scripting. However, this approach requires more responsibility from the user, deciding whom he or she trusts. The related concerns include a non-responsive authority server, wrong evaluation of the signer identity when issuing certificates, and known applet publishers still doing something that the user would not approve of. Hence signed applets that appeared from Java 1.1 may actually have more security concerns. | ||
=== Self-signed === | === Self-signed === | ||
Self-signed applets, which are applets signed by the developer themselves, may potentially pose a security risk; java plugins provide a warning when requesting authorization for a self-signed applet, as the function and safety of the applet is guaranteed only by the developer itself, and has not been independently confirmed. Such self-signed certificates are usually only used during development prior to release where third-party confirmation of security is unimportant, but most applet developers will seek third-party signing to ensure that users trust the applet's safety. | Self-signed applets, which are applets signed by the developer themselves, may potentially pose a security risk; java plugins provide a warning when requesting authorization for a self-signed applet, as the function and safety of the applet is guaranteed only by the developer itself, and has not been independently confirmed. Such self-signed certificates are usually only used during development prior to release where third-party confirmation of security is unimportant, but most applet developers will seek third-party signing to ensure that users trust the applet's safety. | ||
Java security problems are not fundamentally different from similar problems of any client-side scripting platform<ref>{{Cite web|url=http://www.wiley.com/legacy/compbooks/press/mcgch1.html|title=To be fair, significantly more World Wide Web users use the Netscape product than use the Microsoft product today, though the gap appears to be closing|website=Wiley.com|access-date=2017-03-17}}</ref> | Java security problems are not fundamentally different from similar problems of any client-side scripting platform<ref>{{Cite web|url=http://www.wiley.com/legacy/compbooks/press/mcgch1.html|title=To be fair, significantly more World Wide Web users use the Netscape product than use the Microsoft product today, though the gap appears to be closing|website=Wiley.com|access-date=2017-03-17}}</ref> . In particular, all issues related to signed applets also apply to Microsoft [[Software:ActiveX|ActiveX]] components. | ||
As of 2014, self-signed and unsigned applets are no longer accepted by the commonly available Java plugins or Java Web Start. Consequently, developers who wish to deploy Java applets have no alternative but to acquire trusted certificates from commercial sources. | As of 2014, self-signed and unsigned applets are no longer accepted by the commonly available Java plugins or Java Web Start. Consequently, developers who wish to deploy Java applets have no alternative but to acquire trusted certificates from commercial sources. | ||
| Line 106: | Line 107: | ||
== See also ==<!-- PLEASE RESPECT ALPHABETICAL ORDER --> | == See also ==<!-- PLEASE RESPECT ALPHABETICAL ORDER --> | ||
* [[Software:ActiveX|ActiveX]] | * [[Software:ActiveX|ActiveX]] | ||
* [[Software:Adobe Flash Player|Adobe Flash Player]] | |||
* [[Curl (programming language)]] | * [[Curl (programming language)]] | ||
* [[Software:Jakarta Servlet|Jakarta Servlet]] | * [[Software:Jakarta Servlet|Jakarta Servlet]] | ||
| Line 111: | Line 113: | ||
* [[Software:JavaFX|JavaFX]] | * [[Software:JavaFX|JavaFX]] | ||
* [[Rich web application]] | * [[Rich web application]] | ||
* [[SWF]] | |||
* [[Software:WebGL|WebGL]] | * [[Software:WebGL|WebGL]] | ||
* Silverlight | |||
== References == | == References == | ||
| Line 119: | Line 123: | ||
<!-- Please add no links to individual, especially commercial applets here. Too many. --> | <!-- Please add no links to individual, especially commercial applets here. Too many. --> | ||
* [http://www.java.com/download/ Latest version of Sun Microsystems' Java Virtual Machine] (includes browser plug-ins for running Java applets in most web browsers). | * [http://www.java.com/download/ Latest version of Sun Microsystems' Java Virtual Machine] (includes browser plug-ins for running Java applets in most web browsers). | ||
* [ | * [https://docs.oracle.com/javase/tutorial/deployment/applet/index.html Information about writing applets from Oracle] | ||
* [ | * [https://java.sun.com/applets/jdk/1.4/index.html Demonstration applets from Sun Microsystems] (JDK 1.4{{snd}} include source code) | ||
{{Java (Sun)}} | {{Java (Sun)}} | ||
{{Java desktop}} | |||
{{DEFAULTSORT:Applet}} | {{DEFAULTSORT:Applet}} | ||
Latest revision as of 21:36, 11 February 2026








Java applets are small applications written in the Java programming language, or another programming language that compiles to Java bytecode, and delivered to users in the form of Java bytecode.
At the time of their introduction, the intended use was for the user to launch the applet from a web page, and for the applet to then execute within a Java virtual machine (JVM) in a process separate from the web browser itself. A Java applet could appear in a frame of the web page, a new application window, a program from Sun called appletviewer,[6] or a stand-alone tool for testing applets.[clarification needed]
Java applets were introduced in the first version of the Java language, which was released in 1995. Beginning in 2013, major web browsers began to phase out support for NPAPI, the underlying technology applets used to run. with applets becoming completely unable to be run by 2015–2017. Java applets were deprecated by Java 9 in 2017.[7][8][9][10][11] Java applets were deprecated for removal by Java 17 in 2021.[12] Java applets are targeted to be removed by Java 26 in 2026.[13]
Java applets were usually written in Java, but other languages such as Jython, JRuby, Pascal,[14] Scala, NetRexx, or Eiffel (via SmartEiffel) could be used as well.
Unlike early versions of JavaScript, Java applets had access to 3D hardware acceleration, making them well-suited for non-trivial, computation-intensive visualizations. Since applets' introduction, JavaScript has gained support for hardware-accelerated graphics via canvas technology (or specifically WebGL, then later WebGPU in the case of 3D graphics),[15][16] as well as just-in-time compilation.[17]
Since Java bytecode is cross-platform (or platform independent), Java applets could be executed by clients for many platforms, including Microsoft Windows, FreeBSD, Unix, macOS and Linux. They could not be run on mobile devices, which do not support running standard Oracle JVM bytecode. Android devices can run code written in Java compiled for the Android Runtime.
Overview
The applets are used to provide interactive features to web applications that cannot be provided by HTML alone. They can capture mouse input and also have controls like buttons or check boxes. In response to user actions, an applet can change the provided graphic content. This makes applets well-suited for demonstration, visualization, and teaching. There are online applet collections for studying various subjects, from physics to heart physiology.
An applet can also be a text area only; providing, for instance, a cross-platform command-line interface to some remote system. If needed, an applet can leave the dedicated area and run as a separate window. However, applets have very little control over web page content outside the applet's dedicated area, so they are less useful for improving the site appearance in general, unlike other types of browser extensions (while applets like news tickers or WYSIWYG editors are also known). Applets can also play media in formats that are not natively supported by the browser.
Pages coded in HTML may embed parameters within them that are passed to the applet. Because of this, the same applet may have a different appearance depending on the parameters that were passed.
As applets were available before HTML5, modern CSS and JavaScript interface DOM were standard, they were also widely used for trivial effects such as mouseover and navigation buttons. This approach, which posed major problems for accessibility and misused system resources, is no longer in use and was strongly discouraged even at the time.
Technical information
Most browsers executed Java applets in a sandbox, preventing applets from accessing local data like the file system.[18] The code of the applet was downloaded from a web server, after which the browser either embedded the applet into a web page or opened a new window showing the applet's user interface.
The first implementations involved downloading an applet class by class. While classes are small files, there are often many of them, so applets got a reputation as slow-loading components. However, since .jar files were introduced, an applet is usually delivered as a single file that has a size similar to an image file (hundreds of kilobytes to several megabytes).
Java system libraries and runtimes are backwards-compatible, allowing one to write code that runs both on current and on future versions of the Java virtual machine.
Similar technologies
Many Java developers, blogs and magazines recommended that the Java Web Start technology be used in place of applets.[19] Java Web Start allowed the launching of unmodified applet code, which then ran in a separate window (not inside the invoking browser).
A Java Servlet is sometimes informally compared to be "like" a server-side applet, but it is different in its language, functions, and in each of the characteristics described here about applets.
Embedding into a web page
The applet would be displayed on the web page by making use of the deprecated applet HTML element,[20] or the recommended object element.[21] The embed element can be used[22] with Mozilla family browsers (embed was deprecated in HTML 4 but is included in HTML 5). This specifies the applet's source and location. Both object and embed tags can also download and install Java virtual machine (if required) or at least lead to the plugin page. applet and object tags also support loading of the serialized applets that start in some particular (rather than initial) state. Tags also specify the message that shows up in place of the applet if the browser cannot run it due to any reason.
However, despite object being officially a recommended tag in 2010, the support of the object tag was not yet consistent among browsers and Sun kept recommending the older applet tag for deploying in multibrowser environments,[23] as it remained the only tag consistently supported by the most popular browsers. To support multiple browsers, using the object tag to embed an applet would require JavaScript (that recognizes the browser and adjusts the tag), usage of additional browser-specific tags or delivering adapted output from the server side.
The Java browser plug-in relied on NPAPI, which nearly all web browser vendors have removed support for, or do not implement, due to its age and security issues. In January 2016, Oracle announced that Java runtime environments based on JDK 9 will discontinue the browser plug-in.[24]
Advantages
A Java applet could have any or all of the following advantages:[25]
- It was simple to make it work on FreeBSD, Linux, Microsoft Windows and macOS – that is, to make it cross-platform. Applets were supported by most web browsers through the first decade of the 21st century; since then, however, most browsers have dropped applet support for security reasons.
- The same applet would work on "all" installed versions of Java at the same time, rather than just the latest plug-in version only. However, if an applet requires a later version of the Java Runtime Environment (JRE) the client would be forced to wait during the large download.
- Most web browsers cached applets so they were quick to load when returning to a web page. Applets also improved with use: after a first applet is run, the JVM was already running and subsequent applets started quickly (the JVM will need to restart each time the browser starts afresh). JRE versions 1.5 and greater restarted the JVM when the browser navigates between pages, as a security measure which removed that performance gain.
- It moved work from the server to the client, making a web solution more scalable with the number of users/clients.
- If a standalone program (like Google Earth) talks to a web server, that server normally needs to support all prior versions for users who have not kept their client software updated. In contrast, a browser loaded (and cached) the latest applet version, so there is no need to support legacy versions.
- Applet naturally supported changing user state, such as figure positions on the chessboard.
- Developers could develop and debug an applet directly simply by creating a main routine (either in the applet's class or in a separate class) and calling init() and start() on the applet, thus allowing for development in their favorite Java SE development environment. All one had to do was to re-test the applet in the AppletViewer program or a web browser to ensure it conforms to security restrictions.
- An untrusted applet had no access to the local machine and can only access the server it came from. This makes applets much safer to run than the native executables that they would replace. However, a signed applet could have full access to the machine it is running on, if the user agreed.
- Java applets were fast, with similar performance to natively installed software.
Disadvantages
Java applets had the following disadvantages compared to other client-side web technologies:
- Java applets would depend on a Java Runtime Environment (JRE), a complex and heavy-weight software package. They also normally required a plug-in for the web browser. Some organizations only allow software installed by an administrator. As a result, users were unable to view applets unless one was important enough to justify contacting the administrator to request installation of the JRE and plug-in.
- If an applet requires a newer JRE than available on the system, the user running it the first time will need to wait for the large JRE download to complete.
- Mobile browsers on iOS or Android, never run Java applets at all.[26] Even before the deprecation of applets on all platforms, desktop browsers phased out Java applet support concurrently with the rise of mobile operating systems.
- There was no standard to make the content of applets available to screen readers. Therefore, applets harmed the accessibility of a web site to users with special needs.
- As with any client-side scripting, security restrictions made it difficult or even impossible for some untrusted applets to achieve their desired goals. Only by editing the java.policy file in the JAVA JRE installation could one grant access to the local filesystem or system clipboard, or to network sources other than the one that served the applet to the browser.
- Most users did not care about the difference between untrusted and trusted applets, so this distinction did not help much with security. The ability to run untrusted applets was eventually removed entirely to fix this, before all applets were removed.
Compatibility-related lawsuits
Sun made considerable efforts to ensure compatibility is maintained between Java versions as they evolve, enforcing Java portability by law if required. Oracle seems to be continuing the same strategy.
1997: Sun vs Microsoft
The 1997 lawsuit,[27] was filed after Microsoft created a modified Java Virtual Machine of their own, which shipped with Internet Explorer. Microsoft added about 50 methods and 50 fields[27] into the classes within the java.awt, java.lang, and java.io packages. Other modifications included removal of RMI capability and replacement of Java Native Interface from JNI to RNI, a different standard. RMI was removed because it only easily supports Java to Java communications and competes with Microsoft DCOM technology. Applets that relied on these changes or just inadvertently used them worked only within Microsoft's Java system. Sun sued for breach of trademark, as the point of Java was that there should be no proprietary extensions and that code should work everywhere. Microsoft agreed to pay Sun $20 million, and Sun agreed to grant Microsoft limited license to use Java without modifications only and for a limited time.[28]
2002: Sun vs Microsoft
Microsoft continued to ship its own unmodified Java virtual machine. Over the years it became extremely outdated yet still default for Internet Explorer. A later study revealed that applets of this time often contain their own classes that mirror Swing and other newer features in a limited way.[29] In 2002, Sun filed an antitrust lawsuit, claiming that Microsoft's attempts at illegal monopolization had harmed the Java platform. Sun demanded Microsoft distribute Sun's current, binary implementation of Java technology as part of Windows, distribute it as a recommended update for older Microsoft desktop operating systems and stop the distribution of Microsoft's Virtual Machine (as its licensing time, agreed in the prior lawsuit, had expired).[28] Microsoft paid $700 million for pending antitrust issues, another $900 million for patent issues and a $350 million royalty fee to use Sun's software in the future.[30][non-primary source needed]
Security
The neutrality of this section is disputed. (November 2021) (Learn how and when to remove this template message) |
There were two applet types with very different security models: signed applets and unsigned applets.[31] Starting with Java SE 7 Update 21 (April 2013) applets and Web-Start Apps are encouraged to be signed with a trusted certificate, and warning messages appear when running unsigned applets.[32] Further, starting with Java 7 Update 51 unsigned applets were blocked by default; they could be run by creating an exception in the Java Control Panel.[33]
Unsigned
Limits on unsigned applets were understood as "draconian": they have no access to the local filesystem and web access limited to the applet download site; there are also many other important restrictions. For instance, they cannot access all system properties, use their own class loader, call native code, execute external commands on a local system or redefine classes belonging to core packages included as part of a Java release. While they can run in a standalone frame, such frame contains a header, indicating that this is an untrusted applet. Successful initial call of the forbidden method does not automatically create a security hole as an access controller checks the entire stack of the calling code to be sure the call is not coming from an improper location.
Some studies mention applets crashing the browser or overusing CPU resources but these are classified as nuisances and not as true security flaws. However, unsigned applets may be involved in combined attacks that exploit a combination of multiple severe configuration errors in other parts of the system. An unsigned applet can also be more dangerous to run directly on the server where it is hosted because while code base allows it to talk with the server, running inside it can bypass the firewall. An applet may also try DoS attacks on the server where it is hosted, but usually people who manage the web site also manage the applet, making this unreasonable. Communities may solve this problem via source code review or running applets on a dedicated domain.
The unsigned applet can also try to download malware hosted on originating server. However it could only store such file into a temporary folder (as it is transient data) and has no means to complete the attack by executing it. There were attempts to use applets for spreading Phoenix and Siberia exploits this way, but these exploits do not use Java internally and were also distributed in several other ways.
Signed
A signed applet[34] contains a signature that the browser should verify through a remotely running, independent certificate authority server. Producing this signature involves specialized tools and interaction with the authority server maintainers. Once the signature is verified, and the user of the current machine also approves, a signed applet can get more rights, becoming equivalent to an ordinary standalone program. The rationale is that the author of the applet is now known and will be responsible for any deliberate damage. This approach allows applets to be used for many tasks that are otherwise not possible by client-side scripting. However, this approach requires more responsibility from the user, deciding whom he or she trusts. The related concerns include a non-responsive authority server, wrong evaluation of the signer identity when issuing certificates, and known applet publishers still doing something that the user would not approve of. Hence signed applets that appeared from Java 1.1 may actually have more security concerns.
Self-signed
Self-signed applets, which are applets signed by the developer themselves, may potentially pose a security risk; java plugins provide a warning when requesting authorization for a self-signed applet, as the function and safety of the applet is guaranteed only by the developer itself, and has not been independently confirmed. Such self-signed certificates are usually only used during development prior to release where third-party confirmation of security is unimportant, but most applet developers will seek third-party signing to ensure that users trust the applet's safety.
Java security problems are not fundamentally different from similar problems of any client-side scripting platform[35] . In particular, all issues related to signed applets also apply to Microsoft ActiveX components.
As of 2014, self-signed and unsigned applets are no longer accepted by the commonly available Java plugins or Java Web Start. Consequently, developers who wish to deploy Java applets have no alternative but to acquire trusted certificates from commercial sources.
Alternatives
Alternative technologies exist (for example, WebAssembly[36] and JavaScript) that satisfy all or more of the scope of what was possible with an applet. JavaScript could coexist with applets in the same page, assist in launching applets (for instance, in a separate frame or providing platform workarounds) and later be called from the applet code. As JavaScript gained in features and performance, the support for and use of applets declined, until their eventual removal.
See also
- ActiveX
- Adobe Flash Player
- Curl (programming language)
- Jakarta Servlet
- Java Web Start
- JavaFX
- Rich web application
- SWF
- WebGL
- Silverlight
References
- ↑ "The home site of the 3D protein viewer (Openastexviewer) under LGPL". https://openastexviewer.net/web/.
- ↑ "Generation of an action potential in cardiac cells using interactive java applet. Excitable media. movies excitable media Fitzhug nagumo beeler reuter luo rudy model mathematical cell modeling". https://thevirtualheart.org/CAPindex.html.
- ↑ "The home site of the Mandelbrot set applet under GPL". http://math.uchicago.edu/~dannyc/fractals/simple.html.
- ↑ "The home site of the chess applet under BSD". http://english.op.org/~peter/ChessApp/.
- ↑ "Next Generation in Applet Java Plug-in Technology". http://java.sun.com/developer/technicalArticles/javase/newapplets/.
- ↑ "appletviewer — Java SE 8". Oracle. https://docs.oracle.com/javase/8/docs/technotes/tools/windows/appletviewer.html.
- ↑ "Java 9 Release Notes". https://www.oracle.com/technetwork/java/javase/9-deprecated-features-3745636.html.
- ↑ "JEP 289: Deprecate the Applet API". https://openjdk.java.net/jeps/289.
- ↑ "JPG blog: Moving to a Plugin-Free Web". https://blogs.oracle.com/java-platform-group/entry/moving_to_a_plugin_free.
- ↑ "JPG blog: Further Updates to 'Moving to a Plugin-Free Web'". https://blogs.oracle.com/java-platform-group/entry/further_updates_to_moving_to.
- ↑ "Java Client Roadmap Update". https://www.oracle.com/technetwork/java/javase/javaclientroadmapupdate2018mar-4414431.pdf.
- ↑ "JEP 398: Deprecate the Applet API for Removal". https://openjdk.org/jeps/398.
- ↑ "JEP 504: Remove the Applet API". https://openjdk.org/jeps/504.
- ↑ "FPC JVM – Free Pascal wiki". https://wiki.freepascal.org/FPC_JVM.
- ↑ "canvas – HTML". Mozilla Developer Network. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas#Browser_compatibility.
- ↑ "WebGL – Web API Interfaces". Mozilla Developer Network. https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API#Browser_compatibility.
- ↑ "Design Elements – Chrome V8". https://developers.google.com/v8/design?hl=en.
- ↑ McGraw, Gary; Felten, Edward (1999). "What Untrusted Java Code Can't Do". http://www.securingjava.com/chapter-two/chapter-two-2.html.
- ↑ Srinivas, Raghavan N. (2001-07-06). "Java Web Start to the rescue". JavaWorld. https://www.infoworld.com/article/2075391/java-web-start-to-the-rescue.html.
- ↑ "Objects, Images, and Applets in HTML documents". https://www.w3.org/TR/html401/struct/objects.html#edef-APPLET.
- ↑ "Objects, Images, and Applets in HTML documents". https://www.w3.org/TR/html401/struct/objects.html#edef-OBJECT.
- ↑ "Java Downloads for All Operating Systems". Java.com. 14 August 2012. http://www.java.com/en/download/manual.jsp.
- ↑ "Sun's position on applet and object tags". http://download.java.net/jdk7/docs/technotes/guides/plugin/developer_guide/using_tags.html#object.
- ↑ "Oracle deprecates the Java browser plugin, prepares for its demise". 28 January 2016. https://arstechnica.com/information-technology/2016/01/oracle-deprecates-the-java-browser-plugin-prepares-for-its-demise/.
- ↑ Oracle official overview on Java applet technology
- ↑ "How do I get Java for Mobile device?". 30 July 2014. http://www.java.com/en/download/faq/java_mobile.xml.
- ↑ 27.0 27.1 Zukowski, John (1997-10-01). "What does Sun's lawsuit against Microsoft mean for Java developers?". JavaWorld. https://www.infoworld.com/article/2077055/what-does-sun-s-lawsuit-against-microsoft-mean-for-java-developers-.html.
- ↑ 28.0 28.1 "Sun's page, devoted for the lawsuits against Microsoft". http://www.sun.com/lawsuit/summary.html.
- ↑ Kenai.com (2011) Most common problems, found in the code of the reviewed applets.
- ↑ "Microsoft and Sun Microsystems Enter Broad Cooperation Agreement; Settle Outstanding Litigation: Ten Year Agreement Sets New Framework for Industry Cooperation; Reduces Cost and Complexity for Customers". Microsoft. 25 February 2010. http://www.microsoft.com/presspass/press/2004/apr04/04-02SunAgreementPR.mspx.
- ↑ "What Applets Can and Cannot Do (The Java Tutorials > Deployment > Java Applets)". https://docs.oracle.com/javase/tutorial/deployment/applet/security.html.
- ↑ "Java Applet & Web Start – Code Signing". Oracle. https://www.oracle.com/technetwork/java/javase/tech/java-code-signing-1915323.html#60.
- ↑ "What should I do when I see a security prompt from Java?". Oracle. http://java.com/en/download/help/appsecuritydialogs.xml.
- ↑ "Java Applet Security | Java 2 Platform Security | InformIT". https://www.informit.com/articles/article.aspx?p=433382&seqNum=2.
- ↑ "To be fair, significantly more World Wide Web users use the Netscape product than use the Microsoft product today, though the gap appears to be closing". http://www.wiley.com/legacy/compbooks/press/mcgch1.html.
- ↑ "Mozilla tries to do Java as it should have been – with a WASI spec for all devices, computers, operating systems" (in en). https://www.theregister.com/2019/03/29/mozilla_wasi_spec/.
External links
- Latest version of Sun Microsystems' Java Virtual Machine (includes browser plug-ins for running Java applets in most web browsers).
- Information about writing applets from Oracle
- Demonstration applets from Sun Microsystems (JDK 1.4 – include source code)
