Using Swing Components: Examples (The Java™ Tutorials > Creating a GUI with Swing > Using Swing Components) The table that follows lists every example in the Using Swing Components lesson, with links to required files and to where each example is discussed.
The first column of the table has links to JNLP files that let you run the examples using Java™ Web Start. NOTE: Release 7.0 is required to run all applets and Java Web Start examples. Most examples will run on an earlier release but you must compile and run them locally. Structure of the JNLP File (The Java™ Tutorials > Deployment > Deployment In-Depth) This topic describes the syntax of the Java Network Launch Protocol (JNLP) file for rich Internet applications (RIAs).
The following code snippet shows a sample JNLP file for a Java Web Start application: <? Xml version="1.0" encoding="UTF-8"? ><jnlp spec="1.0+" codebase="" href=""><information><title>Dynamic Tree Demo</title><vendor>Dynamic Team</vendor><icon href="sometree-icon.jpg"/><offline-allowed/></information><resources><! -- Application Resources --><j2se version="1.6+" href= " href="DynamicTreeDemo.jar" main="true" /></resources><application-desc name="Dynamic Tree Demo Application" main-class="webstartComponentArch.DynamicTreeApplication" width="300" height="300"></application-desc><update check="background"/></jnlp>
Javax.jnlp (JNLP API Reference 1.8.0_40) Java Web Start Guide. Lesson: Deployment In-Depth (The Java™ Tutorials > Deployment) Java Network Launch Protocol (The Java™ Tutorials > Deployment > Deployment In-Depth) The Java Network Launch Protocol (JNLP) enables an application to be launched on a client desktop by using resources that are hosted on a remote web server.
Java Plug-in software and Java Web Start software are considered JNLP clients because they can launch remotely hosted applets and applications on a client desktop. See Java Network Launching Protocol and API Specification Change Log for details. Recent improvements in deployment technologies enable us to launch rich Internet applications (RIAs) by using JNLP. Both applets and Java Web Start applications can be launched by using this protocol.
RIAs that are launched by using JNLP also have access to JNLP APIs. JNLP is enabled by a RIA's JNLP file. JNLP API (The Java™ Tutorials > Deployment > Doing More With Java Rich Internet Applications) Rich Internet applications (RIAs) can use the Java Network Launch Protocol (JNLP) API to perform extensive operations on the user's environment.
When launched by using JNLP, even unsigned RIAs can perform the following operations with the user's permission: They can use the FileOpenService and FileSaveService API to access the user's file system..They can use the ClipboardService API to access the shared system-wide clipboard.They can use the PrintService API to access printing functions.They can use the PersistenceService API to access persistence storage.They can use the DownloadService API to control how the RIA is downloaded and cached.They can use the DownloadServiceListener API to determine progress of the RIA's download.They can use the SingleInstanceService API to decide how to handle arguments when multiple instances of the RIA are launched.They can use the ExtendedService API to request permission to open certain files that have not been opened before.
Distributing an Application using Java Web Start. Distributing your Application as an Executable JAR file. A JAR (Java ARchive) is a way of packaging together all of the resources associated with a program (class files, images, sounds, etc.).
Putting your program in a JAR allows it to be distributed as a single executable file, saving space and simplifying the download process. The information in this tutorial applies to Java version 1.2 or higher. For more information about JAR files, follow Sun's tutorial. To learn about signing the JAR and Java Web Start. A simple example. Manifest-Version: 1.0 Main-Class: Hello Then, we create the archive by typing: jar cmf Hello.mf Hello.jar Hello.class Hello.java and run it by typing: Passing command line arguments to javaws (Java WebStart) executable. Java Applet & WebStart Rich Internet Applications - Java Programming Tutorial. 1.
Applets An applet is a Java program, which can be downloaded from a remote server and executes inside the web browser of the local machine. Applets are executed inside the browser via the so-called "Java Plug-in", which is a JRE capable of running Java applets in a secure manner (just like most web browsers have plug-ins for running flash, JavaScript, VBScript and other programs). 1.1 Hello-World Applet Let's begin by writing an applet that says "Hello, world! " Deploying a Java Web Start Application (The Java™ Tutorials > Deployment > Java Web Start) To deploy your Java Web Start application, first compile the source code, package it as a JAR file, and sign the JAR file.
Java Web Start applications are launched by using the Java Network Launch Protocol (JNLP). Hence, you must create a JNLP file to deploy your application. The Deployment Toolkit script contains useful JavaScript functions that can be used to deploy Java Web Start applications on a web page. If you are unfamiliar with these deployment technologies, review the Deployment In-Depth lesson before proceeding.
Here are some step-by-step instructions to package and deploy your application. JNLPAppletLauncher Home. Overview The JNLPAppletLauncher is a general purpose JNLP-based applet launcher class for deploying applets that use extension libraries containing native code.
It allows applets to use extensions like Java 3D, JOGL, and JOAL very easily, with just a few additional parameters to the <applet> tag, on Java SE versions as far back as 1.4.2. JOGL JNLP Applet Test. In case your Java Plugin supports JNLP, the applet-gears.jnlp is used, otherwise it shall fallback to NApplets.
Note that it is important for the startup time to have the same JVM arguments in the applet tags, as well as within the JNLP applet description. Deploying an Applet (The Java™ Tutorials > Deployment > Deployment In-Depth) Deploying an Applet (The Java™ Tutorials > Deployment > Deployment In-Depth) You can deploy applets by using the runApplet function of the Deployment Toolkit script.
The runApplet function ensures that the required minimum version of the Java Runtime Environment (JRE) software exists on the client and then runs the applet. The runApplet function generates an HTML <applet> tag with the information provided. Note: Depending on the type of browser, you might be unable to view the HTML generated by the Deployment Toolkit script when you try to view the source for the web page. To view the generated HTML, try saving the HTML page after it has been loaded, or use a tool such as Firebug (a Mozilla Firefox add-on).
Embedding JNLP File in Applet Tag (The Java™ Tutorials > Deployment > Deployment In-Depth) Embedding JNLP File in Applet Tag (The Java™ Tutorials > Deployment > Deployment In-Depth) The Java Community Process(SM) Program - JSRs: Java Specification Requests - detail JSR# 56. Using Other Swing Features: Examples (The Java™ Tutorials > Creating a GUI with Swing > Using Other Swing Features) Java SE Desktop Technologies - Java Web Start Technology. Launching Java WebStart from the Command Line. One generally starts a Java WebStart application by clicking on a link in a web browser. WebStart is typically registered as the helper application for content with mime type application/x-java-jnlp-file, so the browser downloads the jnlp content and hands it off to WebStart. Depending on configuration, desktop shortcuts may be installed to speed up subsequent launches, and cached applications can also be launched from within the WebStart control panel.
On occasion, though, it is useful to launch WebStart “manually” from the command line, without the overhead of getting a web browser involved. The most straightforward way to do this is to simply use the “javaws” command included in the JDK. This is located in the “bin” directory in Linux and Windows distributions of the JDK or JRE. /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/javaws When executed with the -viewer argument, e.g javaws -viewer If javaws is given the path to a jnlp file, e.g. Security Obscurity Blog: The Latest Java Exploit with Security Prompt/Warning Bypass (CVE-2013-2423) From Java SE 7 update 11 oracle has introduced a new security features called security warning that prompts a window every time an applet request for execution.
For example, if we want to execute latest Java SE 7 update 17 exploit we get this warning. Yesterday Immunity has published a blog post explaining a new vulnerability they have found into the java validating mechanism which allow to execute an untrusted applet without showing the warning. For in-dept details read their blog post here. Briefly, to bypass the above prompt you must call the applet with the parameter __applet_ssv_validated set to true. The only way to manipulate this parameter is to use a java Network Launch Protocol file. JavaDesktop: The JDIC Project. Introducing JDIC Desktop Integration for Java Applications June 1, 2004 Sun has launched the JDesktop Integration Components (JDIC) project on javadesktop.org.
JDIC will enable applications written for the Java™ platform (Java applications) to integrate more seamlessly with their native desktop environment. Initially the project supports features such as embedding the native HTML browser, programmatically opening the native mail tool, using registered file-type viewers, and packaging JNLP applications as RPM, SVR4, and MSI installer packages. Desktop Integration of Java Applications Today Unlike many desktop applications, Web pages are traditionally designed to have a platform-independent appearance that looks the same in each browser they're displayed in. The Java platform has enabled this level of seamless desktop integration with functionality such as its native look and feels (XP, GTK, Aqua), drag and drop, and clipboard support. JavaDesktop: The JDIC Project. Introducing JDIC Desktop Integration for Java Applications June 1, 2004 Sun has launched the JDesktop Integration Components (JDIC) project on javadesktop.org.
JDIC will enable applications written for the Java™ platform (Java applications) to integrate more seamlessly with their native desktop environment. Initially the project supports features such as embedding the native HTML browser, programmatically opening the native mail tool, using registered file-type viewers, and packaging JNLP applications as RPM, SVR4, and MSI installer packages. Signed JNLP Files. Signing a JNLP File There are several advantages to signing a JNLP file. It will: Signing a JNLP File (The Java Tutorials Blog) There are several advantages to signing a JNLP file. It will: Ensure that others cannot change the content in your JNLP file. For example, by adding a random library, or changing application information.Allow the use of arbitrary Java Virtual Machine (JVM) options and Java system properties in your application.Prevent others from referencing your JAR file directly in their HTML browser applets.