Sun Java Solaris Communities My SDN Account Join SDN
 
Java Plug-in 1.3 Documentation

Using the HTML Converter

 

Documentation | FAQs
What's New in 1.3?

The Java Plug-in HTML Converter converts a file containing applets to a form that uses Java Plug-in. To use the HTML Converter, follow the directions below.

Getting Started with the HTML Converter

  1. Download the HTML Converter
    The HTML Converter is available here.

  2. Start the converter
    On Microsoft Windows:
    1. Unzip htmlconv1_3.zip using any archiving utility.
    2. In an MS-DOS prompt, CD to the directory in which you unzipped htmlconv1_3.zip.
    3. CD into the converter\classes directory.
    4. Launch the HTML Converter with this command:
      java -classpath . HTMLConverter
      

    On Solaris or Linux:

    1. CD to the directory in which htmlconv1_3.zip is located.
    2. Extract the contents of the zip file using this command.
      jar -xf htmlconv1_3.zip
      
    3. CD into the converter/classes directory.
    4. Launch the HTML Converter with this command:
      java -classpath . HTMLConverter
      

Using the Graphical HTML Converter

  1. Start the HTML Converter
    Start the graphical interface by using one of the methods above. For instructions for using the HTML Converter directly from the command line please see Using the Command Line to Run the Converter.
  2. Select files to convert
    Choose "Browse..." to select the folder from a dialog box. Once you have selected a folder, you can choose specific files to be converted by specifying patterns to match in the "Matching File Names" box. You can use * as a wildcard. Each pattern must be separated by a comma.

    Example: Entering *.html,*.htm will cause all files ending with .html and .htm to be converted.

    To convert all the matching files in nested subfolders, select "Include Subfolders".

  3. Choose a backup folder
    The default backup folder has the same name as the folder that contains the source documents with _BAK appended to it.

    Example: If the path to the source document is C:\html\applet.html the backup folder is C:\html_BAK.

    If you want to select a different backup folder, type the new path in the "Backup Files to Folder" box or choose "Browse..." to select the new folder from a dialog box.

  4. Generate a log file
    The log file from the HTML Converter contains basic information related to the conversion process including the date of conversion, number of files processed and the number of applets found.

    If you want a log file to be generated, select "Generate Log File" from the Edit -> Options window. Type the path in the "Specify Location for Log File" box or choose "Browse..." to choose a folder.

  5. Choose a conversion template
    A template file determines how the HTML of your file is altered to use Java Plug-in. If no template is chosen, a default template will be used. The default template will produce converted HTML files that will work with IE and Netscape.

    If you want to use a different template, select it from the drop-down menu labeled "Template File". If you choose "Other Template", you can choose a customized file that will be used as the template. This file must be a template.

  6. Convert the documents
    Click the "Convert..." button to begin the conversion process. A dialog box will show the file being processed, the number of files processed, the number of applets found, and number of errors found.

  7. Exiting the HTML Converter
    When the conversion is complete, the button in the dialog box will change from "Cancel" to "Done". Click "Done" to close the dialog box.

    Select "Exit" from the "File" menu to close the Java Plug-in HTML Converter, or repeat the steps above to choose another set of files to convert.

Using the Command Line to Run the Converter

The HTML Converter now supports a command line interface.

java -classpath . HTMLConverter [ filespecs ] [-simulate] [-options1 value1 [-option2 value2 [...]]]

filespecs
space delimited list of file specs, * wildcard. (*.html *.htm)

options
source
Path to source files. (c:\htmldocs) Default: <userdir>
If the path is relative, it is assumed to be relative to the directory in which HTMLConverter was launched.

backup
Path to write backup files. Default: <userdir>/<source>_bak
If the path is relative, it is assumed to be relative to the directory in which HTMLConverter was launched.

subdirs
Option for processing files in subdirectories. Default: FALSE

template
Name of template file. Default: default.tpl
default.tpl is standard (IE & Navigator) for Windows & Solaris only. Use the default if you are unsure.

log
Path and filename for log file. Default <userdir>/convert.log)

progress
Display standard out progress while converting. Default: true

simulate
Display the specifics to the conversion without converting.
You will be given a list of detailed information specific to the conversion. Use this option if you are unsure.

If only java HTMLConverter is typed at the command line (no filespecs or options), the graphical interface of the converter will be launched.

Templates

The template file determines how the converted applets are coded in the HTML page. A template is simply a text file containing tags that represent the parts of the original applet. By adding, deleteing or rearranginging the tags in a template file, you can alter the output of the converted file.

Supported Tags:

$OriginalApplet$
This tag is substituted for the complete text of the original applet.

$AppletAttributes$
This tag is substituted for all of the applets attributes. (code, codebase, width, height, etc.)

$ObjectAttributes$
This tag is substituted for all the attributes required by the object tag.

$EmbedAttributes$
This tag is substituted for all the attributes required by the embed tag.

$AppletParams$
This tag is substituted for all the applet's <param ...> tags

$ObjectParams$
This tag is substituted for all the <param...> tags required by the object tag.

$EmbedParams$
This tag is substituted for all the <param...> tags required by the embed tag in the form NAME=VALUE

$AlternateHTML$
This tag is substituted for the text in the No support for applets area of the original applet

$CabFileLocation$
This is the URL of the cab file that should be used in each template that targets IE.

$NSFileLocation$
This is the URL of the Netscape plugin that be used in each template that targets Netscape

default.tpl

This is the default template for the converter. The converted page can be used in IE and Navigator on Windows 95 or Windows NT to invoke Java Plug-in.

<OBJECT 
   classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
$ObjectAttributes$ codebase="/products/plugin/1.3/docs/$CabFileLocation$">
$ObjectParams$
<PARAM NAME="type" 
	VALUE="application/x-java-applet;version=1.3">
$AppletParams$<COMMENT>
<EMBED type="application/x-java-applet;version=1.3" 
	$EmbedAttributes$
$EmbedParams$ pluginspage="$NSFileLocation$">
<NOEMBED></COMMENT>
		$AlternateHTML$
	</NOEMBED></EMBED>
</OBJECT>

ieonly.tpl

Pages converted with this template can be used to invoke Java Plug-in in IE on Windows 95 or Windows NT only.

<OBJECT 
   classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
$ObjectAttributes$ codebase="/products/plugin/1.3/docs/$CabFileLocation$">
$ObjectParams$
<PARAM NAME="type" 
	VALUE="application/x-java-applet;version=1.3">
$AppletParams$
$AlternateHTML$
</OBJECT>

nsonly.tpl

Pages converted with this template can be used to invoke Java Plug-in in Navigator on Windows 95 or Windows NT only.

<EMBED type="application/x-java-applet;version=1.3" 
	$EmbedAttributes$
$EmbedParams$ pluginspage="$NSFileLocation$"><NOEMBED>
$AlternateHTML$
</NOEMBED></EMBED>

extend.tpl

Pages converted with this template can be used in any browser or platform. If the browser is IE or Navigator on Windows 95 or Windows NT, Java Plug-in will be invoked. Otherwise, the browser's default JVM is used.

<SCRIPT LANGUAGE="JavaScript"><!--
    var _info = navigator.userAgent; var _ns = false;
    var _ie = (_info.indexOf("MSIE") > 0 
			&& _info.indexOf("Win") > 0 &&
_info.indexOf("Windows 3.1") < 0);
//--></SCRIPT>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
    var _ns = (navigator.appName.indexOf("Netscape") >= 0 &&
((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 &&
java.lang.System.getProperty("os.version").indexOf("3.5") 
				< 0) ||
_info.indexOf("Sun") > 0));
//--></SCRIPT></COMMENT>

<SCRIPT LANGUAGE="JavaScript"><!--
    if (_ie == true) document.writeln('<OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" 
	$ObjectAttributes$
codebase="/products/plugin/1.3/docs/$CabFileLocation$"><NOEMBED><XMP>');
    else if (_ns == true) document.writeln('<EMBED
type="application/x-java-applet;version=1.3" 
	$EmbedAttributes$
$EmbedParams$ pluginspage="$NSFileLocation$">
	<NOEMBED><XMP>');
//--></SCRIPT>
<APPLET $AppletAttributes$></XMP>
$ObjectParams$
<PARAM NAME="type" 
	VALUE="application/x-java-applet;version=1.3">
$AppletParams$
</APPLET>
$AlternateHTML$
</NOEMBED></EMBED></OBJECT>


Using the HTML Converter on Other Platforms

If you want to run the converter on a platform other than Solaris, Microsoft Windows, or Linux, you will need to use the Pure Java installer. Once the installation is done, change directory to the install folder, and set the classpath to

./:./HTMLConverter.jar:./templates

Note: .'s and /'s are UNIX specific. Be sure to use the proper file and path separators for your platform.

Then launch the HTML Converter by invoking the main class, HTMLConverter.

How the HTML Converter Works

HTML that is not part of an applet is transferred from the source file to a temporary file. When an <APPLET tag is reached, the converter parses the applet to the first </APPLET tag and merges the applet data with the template. This is then appended to the temporary file. For more information about templates, see Templates.

If this completes without error, the original HTML file is moved to the backup folder and the temporary (converted) file is renamed to the original file's name. Your original files are never removed from the disk.

Note that the converter effectively converts the files in place. Once you have run the converter, your files are ready to use Java Plug-in.