Java FAQ

What is Java?

Java is a platform independent programming language. You can run applications written in Java on any modern platform, like Windows, Mac, Linux or eComStation.

What do I need to run Java applications?

To run Java applications you need a Java runtime (JRE) for your operating system. You can download Sun's Java runtime from the official Java website.

There can be multiple editions of the Java runtime. You should look for "standard edition", sometimes called "Java for the desktop".

How do I run a Java application?

If you are using Windows and the Java application is distributed as a .jar file, you often simply can doubleclick on the .jar file to start the application.

You can start a .jar application from a console window with the command:

java -jar jar-file

For some Java applications, you need to enter a longer variant:

java -cp jar-file classname

...where classname is something you find in the documentation for the Java application. For versions of Java up to 1.1.8, you use jre -cp jar-file classname instead.

If the application consists of one or more .class files, you use the command:

java basename

...where basename is the name of the main class file without the '.class' extension. If you are using JRE up to version 1.1.8 the command is instead jre -cp . basename.

There are non-standard JREs that use other syntax. With Microsoft's old JRE included in IE, replace jre -cp with jview /cp.

You can use one of the commands above when creating a shortcut icon on your desktop. The java executable always displays a console window. If the Java application is graphical and you don't want to you the console window to be displayed while running the application, replace java with javaw.

What is Swing?

Swing is a collection of GUI components made to work in the same manner on all platforms. Swing is entirely written in Java.

The "opposite" of Swing is AWT, where the native GUI components in the operating system are used. AWT is the "old way" of doing GUIs in Java. Since AWT uses the components in the operating system, it only contains components that exist in all operating systems, which is a big limitation. Some people claim AWT is slow too. For these reasons, Swing was created, the "new way" of doing user interfaces for Java applications. Swing is included in the standard JRE since version 1.2 ("Java2").

Swing has a feature called PLAF; pluggable look and feel. This makes is possible to change the look and feel of the user interface with minimal amount of coding. Some applications lets the user simply choose which look and feel they want to use.

How do I change the Swing look-and-feel for a Java application?

It depends on the application.

My applications use a component I call LAFLoader which reads user-modifiable settings.

What does Java2 mean?

Java2 is not Java version 2, but a name for all versions from 1.2 and above.