javaws Command in Linux



The javaws command in Linux is a utility that allows users to launch Java Web Start applications. Java Web Start enables users to start application software for the Java Platform directly from the Internet using a web browser.

The javaws command, short for Java Web Start, is a utility that allows users to launch Java applications and applets hosted on a network. This command is part of the Java Runtime Environment (JRE) and provides a platform-independent deployment technology for Java applications.

Table of Contents

Here is a comprehensive guide to the options available with the javaws command −

Understanding the javaws Command

Understanding these options can greatly enhance the user's ability to manage and launch Java Web Start applications effectively. It's important to note that some options are advanced and should be used with caution, as they can alter the security and behavior of the applications being launched.

How to Use javaws Command in Linux

Here's a comprehensive guide to using the javaws command in Linux with examples and explanations.

Basic Usage

The most basic use of javaws is to launch a Java application or applet specified in a Java Network Launching Protocol (JNLP) file.

Syntax of javaws Command

The syntax is as follows −

javaws [options] jnlp-file

Where jnlp-file is the path or URL to the JNLP file.

Options of javaws Command

OptionsDescriptions
-aboutDisplays a sample application.
-helpPrints out information about supported commands and basic usage.
-licenseDisplays the GPL license and exits.
-viewerShows the trusted certificate viewer.
-XcacheidsLists available IDs in the cache, which can be used to delete individual applications.
-XclearcacheCleans the JNLP application cache. If an argument is passed, only the specified application is deleted.
-headlessDisables download window and other UIs.
-allowredirectAllows HTTP redirects.
-argAdds an application argument before launching.
-browserLaunches an embedded browser (use only when necessary).
-htmlSpecifies the location of the HTML file to launch.
-jnlpSpecifies the location of the JNLP file to launch.
-nosecurityDisables the secure runtime environment.
-noupdateDisables checking for updates.
-paramAdds an applet parameter before launching.
-propertySets a system property before launching.
-startuptrackerEnables startup time tracker.
-strictEnables strict checking of the JNLP file format.
-updateChecks for updates at specified intervals.
-verboseEnables verbose output.
-versionPrints the IcedTea-Web version and exits.
-XignoreheadersSkips jar header verification.
-xmlUses a strict XML parser to parse the JNLP file.

Each option serves a specific purpose and can be combined to tailor the behavior of the javaws command as needed for various scenarios. For instance, -Xclearcache is particularly useful for troubleshooting or maintenance purposes, while -verbose can aid in debugging issues by providing additional output.

Examples of javaaws Command

In this section, we have a set of examples that demonstrate the use of javaaws command in Linux −

  • Starting an Application
  • Viewing Cache
  • Clearing Cache
  • Uninstalling Applications
  • Importing Applications to Cache
  • Setting Properties
  • Advanced JVM Options
  • Running in Offline Mode
  • Waiting for Application to Exit

Starting an Application

To start an application with javaws, simply pass the JNLP file as an argument −

javaws
Starting Application Uing javaws Command1

Or, if the JNLP file is hosted online −

javaws http://www.example.com/application.jnlp
Starting Application Uing javaws Command2

Viewing Cache

To view the cache viewer in the Java Control Panel, use the -viewer option −

javaws -viewer
Viewing Cache Uing javaws Command

Clearing Cache

To clear the Java Web Start cache, removing all non-installed applications, use the -clearcache option −

javaws -clearcache
Clearing Cache Uing javaws Command

Uninstalling Applications

To uninstall all applications from the cache −

javaws -uninstall
Uninstalling Applications Uing javaws Command1

To remove a specific application, specify the JNLP file −

javaws -uninstall /home/application.jnlp
Uninstalling Applications Uing javaws Command2

Importing Applications to Cache

To import an application to the cache without user interaction, use the -silent and -import options −

javaws -silent -import /application.jnlp
Importing Applications to Cache Uing javaws

Setting Properties

To set a specific deployment property, use the -userConfig option −

javaws -userConfig property-name property-value
Setting Properties Uing javaws Command

To clear a deployment property −

javaws -userConfig property-name

Advanced JVM Options

Pass options to the Java Virtual Machine (JVM) using the -J option −

javaws -J-Xms256m -J-Xmx512m application.jnlp
Advanced JVM Options Uing javaws

This sets the initial heap size to 256 MB and the maximum heap size to 512 MB.

Running in Offline Mode

To run an application in offline mode, use the -offline option −

javaws -offline application.jnlp
Running in Offline Mode in javaws

Waiting for Application to Exit

To start the Java process and wait for its exit, use the -wait option −

javaws -wait application.jnlp
Waiting for Application to Exit Uing javaws

For more detailed information and examples of how to use these options, users can refer to the javaws manual page or the official documentation provided by their Linux distribution or the developers of the Java application they are attempting to run.

Conclusion

The javaws command is a versatile tool for managing Java applications in Linux. It provides options for starting applications, managing the cache, setting properties, and more. By understanding and utilizing these options, users can effectively deploy and control Java applications in their environment.

For more detailed information about the javaws command and its options, you can refer to the official Oracle documentation, Arch Linux manual pages, or other online tutorials.

Remember that the availability of options may vary based on the version of Java installed, and some options may be deprecated in future releases. Always consult the latest documentation for the most accurate information.