JPEG, GIF Encoder Implementation

Properties

High quality GIF and JPEG images may be easily created with the encoder. Before creating a JPEG file with the Java Package, the following requirements must be met:

  1. Place the jar or class files in the CLASSPATH - in Windows®, this is accomplished by modifying the CLASSPATH environment variable to include the full path to the JAR file. For example, the following will add LinearBarCode.jar to the classpath:
    SET CLASSPATH=.;c:\java\classroot\;c:\jars\linear.jar
    The files in the JAR file may also be extracted to the classpath root, making sure the proper directories defined in the JAR are created.
  2. Make sure the period (this represents the current directory) is in the classpath as in the example above.
  3. Install JDK 1.2 or above or verify that JDK 1.2 or above is installed on the server. The encoder requires Java 2 or JDK 1.2 or above to create the JPEG files used by the servlet.
    Special requirements for Linux and UNIX servers:

    • Be sure Java.awt GUI functions are available in the environment. If the Java environment has the java.awt library stripped out, then the encoder will be unable to create image files.
    • If the UNIX or Linux server does not have an X-Window environment, then either (1) use Headless Java or (2) connect to a remote X Server or (3) install the X Windows environment and run an X Windows session or (4) install an emulator, PJA library or virtual frame buffer.

How to create a JPEG or GIF image file:

This is a very simple example of the Java source code used to create an image file from the Linear Java Barcode Package.