Java Applet or Java Application?

My Java programs can be used as an Applet (embedded in a Web page) or as standalone Java applications. In both cases you will need some archive files, which contain the complete application and utility class trees. These archives come in the form of Java ARchives (.jar) files.

 

Running
Applets

An applet can be run by loading its HTML page into your Java enabled web browser.
A disadvantage when running an applet from the internet is that you cannot save, print or copy data to the clipboard, as long as you use the standard Java security settings of your browser. If you lower these restrictions for all Java programs, you should reset them before surfing into the unknowns of the web in order to avoid that someone malicious can read or write files on your computer system.

In some browsers, like Microsoft Internet Explorer, you can declare single web sites as being "trusted" and assign individual security restrictions (file access permission, printing permission) to them. You have to perform the following steps to do so:

  • Use the menu Extras - Internet-Options to show a dialog box and select the Security card.
  • Select the green checkmark Trusted Sites and push the Sites... button to open a new dialog box.
  • Here you add the web site you are trusting, e.g. http://www.mh-aerotools.de/. and close the Trusted Sites dialog box.
  • Adjust the security settings for this Trusted Sites zone by opening the dialog box "Security Settings" and push the button "User defined Java settings" at the bottom of this dialog box. Then you can adjust the Java settings:
    - you should allow access to files for signed applications (like JavaFoil or JavaProp).
  • Closing all open dialog boxes should put the new settings into action - Phew!
  • Reload the page from the site.
  • You will

You will then see a jp_trusted.jpg (2973 Byte) sign in the status line whenever you work with one of the trusted sites.  All other web sites will still use the safe security settings (no checkmark).

Notes:

Not all browsers allow changing file, printer or clipboard access permissions. You have to consult the dosumentation of your browser for details.
 

Running
Applications

Running a program as a Java standalone application makes use of the Java runtime environment and the Java loader, which is usually called java on Unix or either java or javaw under Microsoft Windows. The Java loader loads the main .class file and all related classes from the .jar archive(s), which must be either in the same directory, in one of the directories listed in the CLASSPATH environment variable, or you must specify the path on the command line.

Microsoft Windows:

If you have placed an main archive file like javaprop.jar and the helper classes mhclasses.jar in your current directory, you can run JavaProp by entering the following command line in the DOS command prompt window:

java -cp ./javaprop.jar;./mhclasses.jar MH.JavaProp.JavaProp

or, if these archive files are in the java subdirectory:

java -cp ./java/javaprop.jar;./java/mhclasses.jar MH.JavaProp.JavaProp

Remark: In Microsoft Windows you can also create an icon and associate one of the above command lines with it.

UNIX Systems:

On a UNIX system, you would probably enter a command line like (line is folded to fit on page):

java -classpath ./javaprop.lar:./mhclasses.jar:
     /usr/java/lib/rt.jar:/usr/...path... MH.JavaProp.JavaProp

The trailing classpath elements depend on your local installation; path separator is a ":".

If you run JavaProp as a standalone application, using java, it can access the file system, the clipboard and your printer without changing any browser settings.

Last Resort: use the unpacked archives:

A few Java implementations may have problems with multiple .jar archives. In this case, you can unpack these archives to a directory tree, which will then contain the raw .class files. You will create one tree of utility classes from mhclasses.jar starting in the directory MH under the applet directory and all the application classes in the applet directory.

The directory structure will look similar to the one shown at the left.
All the application classes will be in the Applet Directory above the MH directory. The utility classes will go into directories of their own under the MH directory.

You can then run the main class in the Applet Directory using a command like:

java JavaProp.class

 

 

Java
Versions and Browsers

You should have at least Java version 1.5. I recommend to use the official Java installation as available from the Oracle web site (see below).  In order to be able to run Java programs, the Java Runtime Environment (JRE) is sufficient. There is no need to install the Java Development Kit (JDK) if you do not intend to write programs in Java.

Under Netscape on an IRIX machine I found a quite slow and somewhat buggy Java VM.

 

Java Web Start

The latest Java releases come with a technology called Java Web Start for deploying applications via a web site. The Web Start application caches all files so that you can later run the application without accessing the internet.

Instructions if you have the latest Java version installed (Java 1.5)

  • Download and start JavaFoil automatically by clicking on this link: JavaFoil.
  • Download and start JavaProp automatically by clicking on this link: JavaProp.
  • Download and start JavaPipe automatically by clicking on this link: JavaPipe.

Instructions if you have an older Java version and Java Web Start (Java 1.4 or below)

  • If you want to install Java Web Start visit Suns web site at http://java.sun.com/products/javawebstart/ for availability of Java Web Start downloads.
  • Start the Java Web Start application (German version shown):
  • Enter the address
    http://www.mh-aerotools.de/airfoils/java/ws/remoteapps.htm
    into the address field and press the RETURN or the TAB key to see all available applications.
  • The Web Start application will scan the address and show you all available applications.
  • When you start an application for the first time, you are asked whether you trust it and allow access to files, printer etc. If you grant access, you can run it like a normal application.
  • You can later work offline, because Java Web  Start will cache the application files.
  • For Java 1.5 see http://www.mh-aerotools.de/airfoils/java/ws/remoteapps.htm
   

Parameters

You can supply command line arguments to customize my Java programs. When you are running a standalone application you can pass any desired parameters either as a command line argument at the end of the command line, or as a system property using the -D option of the java command. A typical command line equivalent to the <PARAM> tags in an HTML file below would be:

java -cp .\javaprop.jar;.\mhclasses.jar -DCountry=USA -DFontSize=16 -DScreenCharset=ASCII MH.JavaProp.JavaProp

or

javaw -cp .\javaprop.jar;.\mhclasses.jar -DCountry=USA -DFontSize=16 -DScreenCharset=ASCII MH.JavaProp.JavaProp

The difference between java and javaw is that java blocks the command line and prints its error messages to the command window; whereas javaw does not output error messages and runs in a separate thread (not blocking the console).

Alternatively, if you want to use the applet version, you can use a modified HTML applet page. Then you supply the parameters by <PARAM> tags inside the <APPLET>  or <OBJECT> tag. The HTML code looks like:

Using the  <APPLET> tag Using the <OBJECT> tag
<APPLET NAME="JavaPropApplet"
        CODE="MH.JavaProp.JavaProp.class"
        ARCHIVE="./javaprop.jar,./mhclasses.jar"
        WIDTH="600" HEIGHT="640">
   <PARAM NAME="Country"       VALUE="USA">
   <PARAM NAME="FontSize"      VALUE="16">
   <PARAM NAME="ScreenCharset" VALUE="ASCII">
</APPLET>
<OBJECT ID="JavaPropApplet"
        CODETYPE="application/java"
        CODEBASE="./javaprop.jar ./mhclasses.jar"
       CLASSID="java:MH.JavaProp.JavaProp"
        WIDTH="600" HEIGHT="640">
   <PARAM NAME="Country"       VALUE="USA">
   <PARAM NAME="FontSize"      VALUE="16">
   <PARAM NAME="ScreenCharset" VALUE="ASCII">
</OBJECT>

You then use your browser to load the applet page.

 

You can use any of the following parameters for customization of JavaFoil and JavaProp:

Parameter Name possible Values Comment
ToolbarColor
#xxxxxx
hex RRGGBB color for toolbar and status line background
Country
 USA | GERMANY | FRANCE | 
CANADA | ITALY | SPAIN 
country for language (default: USA)
FontSize
dd
the font size in points, used for screen display (default: 12pt)
ScreenCharset
ASCII | Unicode
symbol set for screen display (default: Unicode)
PrinterCharset
ASCII | Unicode
symbol set for the printer (default: Unicode)
FileCharset
ASCII | Unicode
symbol set for file and clipboard transfer (default: Unicode)

Symbol Set Parameters

Each Java implementation should support the full Unicode character set, but some systems have problems with this. Typically, everything looks nice on screen, but you may receive funny characters or black blobs on printout or in saved files. Then you should try to set the corresponding ...Charset to ASCII. Greek characters (available in Unicode only) will be replaced with a text version like alfa or beta.

Additional Parameters for JavaProp:

Parameter Name possible Values Comment
BladeElements
dd
number of blade elements (default: 40, reasonable: 20-40)

Additional Parameters for JavaFoil:

Parameter Name possible Values Comment
Script
path and name of script file

JavaFoil Scripting Edition only

 

 

How to download a Java program for usage as a standalone Application?

Instructions can be found at the bottom of each applet page.

How to get a Java Virtual Machine (VM)?

Sun offers ist VM for many platforms on its web site at http://java.sun.com/. On this web site you should always be able to find the most recent version of the Java VM for your system.

Last modification of this page: 21.05.18

[Back to Home Page] Suggestions? Corrections? Remarks? e-mail: Martin Hepperle.

Due to the increasing amount of SPAM mail, I have to change this e-Mail address regularly. You will always find the latest version in the footer of all my pages.

It might take some time until you receive an answer and in some cases you may even receive no answer at all. I apologize for this, but my spare time is limited. If you have not lost patience, you might want to send me a copy of your e-mail after a month or so.
This is a privately owned, non-profit page of purely educational purpose. Any statements may be incorrect and unsuitable for practical usage. I cannot take any responsibility for actions you perform based on data, assumptions, calculations etc. taken from this web page.

© 1996-2018 Martin Hepperle
You may use the data given in this document for your personal use. If you use this document for a publication, you have to cite the source. A publication of a recompilation of the given material is not allowed, if the resulting product is sold for more than the production costs.

This document may accidentally refer to trade names and trademarks, which are owned by national or international companies, but which are unknown by me. Their rights are fully recognized and these companies are kindly asked to inform me if they do not wish their names to be used at all or to be used in a different way.

This document is part of a frame set and can be found by navigating from the entry point at the Web site http://www.MH-AeroTools.de/.

Impressum       Datenschutz