2013-12-30

This article is a follow-up to Embedding an Applet in a Web Application. In this article, I will list some topics related to java and Java Applets that will give strong points about their use with proper resources. Some other related content for Java Applets will also be discussed here.

Java is considered as a desired skill among programmers all over the world. As Java Applet is an application of Java, so I would like to start with some information about Applications of Java in real world:

Real World Applications of Java

Amadeus, the largest travel company in the world uses Java for its front end GUI.

GWT (Google Web Toolkit) is a development toolkit written in Java.

Android devices runs Java apps on Java Virtual Machine

Dalvik is an integral part of Android.

Twitter Search uses a Java server called Blender(https://blog.twitter.com/2011/twitter-search-now-3x-faster)

High quality tools are there in Java; Maven, Swing Explorer , Archiva, JMockit etc.

GDA is a framework used for creating customized data acquisition software for scientific purposes.

In large projects, Java is preferred. Examples include:

Complex web applications like http://www.tdameritrade.com

Online banking like Kotak Mahindra(http://www.kotak.com/

Online Shopping Website http://www.ebay.com/

Google Plus is written in Java and JavaScript: https://plus.google.com/

Java ME(Micro Edition) provides a flexible environment and user interface for mobile devices, sensors, printers etc.

Oracle SQL Developer is written in Java.

A rapid web application development platform ColdFusion is written in Java.

A software system lifecycle management (SSLM) and application lifecycle management (ALM) platform known as “Integrity” is written in Java.

Google Guice is an open source software framework is written in Java

The below given statistical information is taken from: http://www.java.com/en/about/



Figure 1: Real World Applications of Java

Real World Applications of Java Applets

ThinkFree: Professional Online Office Suit based on Java Applets and Ajax.

JPC Emulator: It is an x86 emulator written in Java and uses Java Applets.

Statistics: Usage of Applets in developing Web Applications in Statistics is not yet obsolete.

Education: Still studied in universities as part of course-curriculum.

Yahoo Games: Uses Java Applets for games.

Small Applications: Good platform to develop Small Applications

Client Machine: When client machine is to be used the Applets can be considered a good choice i.e. in creating authentication app etc

Android: Billions of Android devices is running them on Java Virtual Machine

Java Web Start: It is a framework developed to run applications outside browser, explained below.

Java Web Start

It is also known as javaws or JAWS. It was developed to run as an independent application. It allows working of Java Software on Internet using Web Browser. The software does not run inside browser like Applets.

Java Web Start advantages over Applets

Java Web Start overcomes many compatibility problems with browsers, java plug-ins and different JVM versions. Web Start programs are independent applications that run in separate frame. They can also launch unmodified applets packaged inside .jar files.

Elimination of “restricted access” by Signed Web Start applications

Java Web Start applications run in restricted environment which doesn’t allow them to access system resources such as local files, network etc. Publishers can easily remove these restrictions by signing their Web Start applications with a tool named as jarsigner that comes with Java Development Kit.

Real World Usage:

Applications

Description/Usage

CrossFTP

FTP client and server.

Jake2

Java port of Quake 2.

PowerTeacher

Gradebook program for student scores, used by schools

Wurm Online

3D Massively Multiplayer Online Fantasy Simulator.

Buho21

Game developed using Java Webstart technology.

Autoplot

Plotting tool for various file formats like ASCII, CDF and NetCDF

Running Reality

Historical atlas and model of human history which includes national borders, armies, and people.

Genevestigator

Online Platform for researchers to explore data for research and clinical applications.

Enabling Web Start (in continuation with previous project)

Follow these steps to enable Web Start as a reasonable way to run software outside browser, unlike Applets:

Right-Click-> AmitJavaApplication -> Properties, then go to Web Start under Application:



Figure 2: Enabling Web Start in NetBeansIDE

Click on Enable Web Start and select “CodeBase” as Local Execution.

After that click on “Customize…” under “Signing” and select “Self Sign by generated key”.

Now, select “Mixed Code” as “Enable Software Protections”. After this click “OK”:



Figure 3: Enabling Web Start and signing

Build the project to Test Java Web Start Locally. Now you can notice some changes under directory i.e. two new files gets created(launch.html and launch.jnlp) with AmitJavaApplication project jar file “AmitJavaApplication.jar”:

Figure 4: Directory Structure changes after building AmitJavaApplication

As shown above for Java Web Start, three files get created:

launch.jnlp – JNLP is Java Network Launching Protocol. This is an XML file with elements and attributes that instruct browsers how to run the application. Some attributes of JNLP files are JNLP spec version, application title, vendor name etc.

launch.html – This is an automatically generated HTML page that has a link to the JNLP file. Users click this link to start applications via Java Web Start.

AmitJavaApplication.jar: The Project jar file.

To Test Web Start from any other location, copy the above shown three files in your WebApplicationProject for running WebStart from any other location. After copying the directory looks like this for “AmitWebApplication”:

Figure 5: AmitWebApplication Directory Structure

Run the WebApplicationAmit project and open launch.html, the following page will be visible after execution:

Link: http://localhost:8080/AmitWebApplication/launch.html

Figure 6: Executing launch.html

Click on Launch, after this you will be given an option to download launch.jnlp file. Download this file at any location on your system:

Figure 7: Downloading Web Start Software launch.jnlp

Now, double-click on “launch.jnlp” and you can see that the same Applet is visible using Web Start as an independent software. This working shows that it is not running under browser as shown in my previous article. So, this is an alternative way to provide users with an option to download software and run it:

Figure 8: Applet visible outside browser

Two forms of Java Applets

Abstract Window Toolkit (AWT): AWT classes and components are contained in the java.awt package hierarchy. It is a set of APIs that provides GUI for java program like buttons, checkbox etc. AWTs are considered obsolete. Swings are preferred over AWT components.

Swings: The Swing classes and components are contained in the javax.swing package hierarchy. Swing components are known as lightweight because they do not require allocation of native resources in the operating system’s windowing toolkit, whereas AWT components are referred to as heavyweight components.

As per Java 6 Update 12, it is possible to mix Swing and AWT widgets without having z-order problems (z-order is the ordering of overlapping two-dimensional objects). Before Java 6 Update 12, mixing Swing components and basic AWT widgets resulted in undesired side.

Swings are considered better than AWT:

Swing components are not implemented by platform-specific code, they are written entirely in Java and therefore are platform-independent unlike AWT components,

It has more flexible components than AWT.

In J2SE 1.2, Swings superseded AWT’s widgets as it provides a richer set of UI widgets.

Swing draws its own widgets

Not yet obsolete, the same used by me in previous article.

Oracle Java Updates

This section provides some important information related to Java Updates and some external website sources. This consists of security enhancements, security fixes, code signing, changes in dialog boxes etc implemented by Oracle Java:

Java Version History

Before going further I would like you to look through Java Version History as mentioned at Wikipedia.

Java SE 6 Update 10
Security fixes and Next Generation Java Plugin

Next Generation Java Plug-in

This release introduced a new implementation of Java Plug-in known as Next Generation Java Plug-in that provides support for applets in web browser which combines the best architectural features of applet and Java Web Start technologies. It also provides a robust platform for deployment of Java and JavaFX content in the web browser.

Figure 9: Next Generation Java Plug-in features as mentioned at Oracle Java Website

Java SE 7 Update 10

Security Enhancements as stated at Oracle Java Website:

The ability to select the desired level of security for unsigned applets, Java Web Start applications, and embedded JavaFX applications that run in a browser. Four levels of security are supported. This feature can be set in the Java Control Panel or (on Microsoft Windows platform only) using a command-line install argument.

Java SE 7 Update 21

This update was related to Java Applet & Web Start – Code Signing was done for the best user experience.”As stated at Oracle Java Website:

“Starting with Java SE 7 Update 21 in April 2013 all Java Applets and Web Start Applications are encouraged to be signed with a trusted certificate.

These steps will significantly lower risks to desktop users.

We are also removing the “low” security settings in the Java Control Panel (e.g., low/custom), to prevent users to from inadvertently opting-out entirely from the security remediation we are building into Java. Users will be better protected by maintaining up-to-date versions of the JRE on their systems, combined with requiring code that is signed by a Trusted Certificate Authority (rather than self-signed or unsigned code). “

Dialog messages

Dialog messages were changed for Unsigned, Self-signed and Signed Applets. This is explained here.

Dialog messages as stated at Oracle Java Website

“Specifically, all Java code executed within the client’s browser will prompt the user. The type of dialog messages presented depends upon risk factors like, code signed or unsigned, code requesting elevate privileges, JRE is above or below the security baseline, etc. Low risk scenarios present a very minimal dialog and include a checkbox to not display similar dialogs by the same vendor in the future. Higher risk scenarios, such as running unsigned jars, will require more user interaction given the increased risk.”

Java Control Panel

As shown in “Java SE 7 Update 21”, “low” security settings in Java Control Panel were removed.

Here, I am demonstrating that how Java Control Panel can be accessed in Windows7-32bit to check the current Security Levels and even changing it:

Java Control Panel can be accessed when“javacpl.exe” is executed from jre bin folder

Figure 10: Accessing Java Control Panel from command prompt

Figure 11: Java Control Panel Security Levels

Java SE 7 Update 25: Java Applet & Web Start – Code Signing

As stated by Oracle Java: “all files must be added to JARs prior to signing” and

“A More Information link is added to the various security dialogs that may pop up prior to launching an Applet or Java Web Start as a means for the user to get more information about the dialog.”

Java SE 7 Update 40: Deployment Rule set

As stated at Oracle Java:

“Deployment Rule Set allowed a desktop administrator to control the level of client compatibility and default prompts across an organization.”

Rich Internet Application Deployment Process

Introduction of Deployment Rule Set

Java SE 7 Update 51 (scheduled in January 2014)

This gives some updates to be scheduled in Java 7 Update 51:

Figure 12: Java SE7 Update 51

Blocked or mixed code
What to do if your applet is blocked or warns of “mixed code”?

Self signed certificates

To help users that needs to use self-signed certificates without involving a public Certificate Authority.

Describes the role of code signing.

New security requirements for RIAs in 7u51 (January 2014)
https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias

Security Resource Center by Oracle for Developers, End-Users, System Administrators and Security Professionals
http://www.oracle.com/technetwork/java/javase/overview/security-2043272.html

Websites using Applets

• Mathematical Applets

Figure 13: Larry Green’s Applet Page: http://www.ltcconline.net/greenL/java/index.html

• Tested Applets for more security

Figure 14: Another Java Applet Page: http://lionsgate.tripod.com/

• Educational Java Applets

Figure 15: Mathematics, Physics and Engineering Applets: http://www.falstad.com/mathphysics.html

The above given site also provides link for other websites which uses Applet. Content as stated on the website: ”Links to other educational sites with math/physics-related information or java applets useful for teaching”:

Figure 16: Links to other sites: http://www.falstad.com/mathphysics.html

• Sample Size Calculator Applet

Figure 17: Sample Survey Resources Applet: http://design.iasri.res.in/ssrs/ecalci2.jsp

• Java Applet: Word Magnets Scramble

Figure 18: Word Magnets Scramble: http://web.cortland.edu/flteach/mm-course/wordscrambleapplets/index.html

• DAEJA viewONE pro

Figure 19: DAEJA viewONE pro: http://www.daeja.com/demo/viewone-pro-demo-list.asp

• Interactive Java Applets

Figure 20: Interactive Java Applets

• You can add Applets given on this website to your website

• To conclude, providing list of Applets around World Wide Web(WWW). The below given screenshot is taken from http://www.montgomerycollege.edu/~dsolomon/273/ca273y/java/resources.html:

Figure 21: List of Applets around WWW

Conclusion

Any programming language is understood best when used perfectly in an appropriate environment and with some years of experience. Every language comes with its pros and cons. C and C++ is being used still after more than 30 years of its existence. So is Java, even after 15 years of its existence.

I would like to mention that I am not a Java advocate and I don’t work for Oracle (and never worked for it before). I work as a Software Developer and Technical Writer in Java and this article reflects my research work on Java and Applets’ existence on behalf of experienced java developers around the web.

With regard to Java Applets, they remain an easy way to embed small Java programs in a web page and are used in many contexts, as shown above. Applets are is still part of course-curriculum in colleges. Oracle Java has been providing many updates which focuses on improving the usage of Applets.

We can expect some further fixes by Oracle in terms of Applet security, signing, resources, reliability etc. It is not yet considered depreciated by Oracle; it means they’re planning something better for it in coming future (maybe in Java 8).

Some security flaws were noticed in usage of Java (and Applets), but Oracle took the necessary steps to address them and updated it to avoid such flaws in future. Keep in touch here for upcoming Java Updates.

The post Java Applets: Obsolete or Still Part of the Web? appeared first on SitePoint.

Show more