Perl via Inline Java

Installation and Configuration

Perl binaries are available from Please download and install the binaries for your Windows Operating System. The Inline::Java module allows you to put Java source code directly “inline” in a Perl script or module. A Java compiler is launched and the Java code is compiled. Then Perl asks the Java classes what public methods have been defined. These classes and methods are available to the Perl program as if they had been written in Perl. See to learn more about Inline::Java.

To install the Inline::Java module:

  1. Add theoryx5 ppm repo using the following command: C:\Perl\bin> ppm repo add
  2. Install the Inline::Java module: C:\Perl\bin> ppm install inline::Java
  3. Set path to your JDK: C:\Perl\bin> set PERL_INLINE_JAVA_J2SDK=C:\Program Files\Java\jdk1.6.0_03

Perl Script to Generate Barcode using Inline Java

The following code will generate a barcode and save the barcode image.


use Inline Java => <<'END_OF_JAVA_CODE', CLASSPATH=> 'lib/Aspose.BarCode.jar';

import com.aspose.barcode.*;

    class BarCode


        public BarCode()



        public void GenerateBarCode() throws Exception


            // Create an instance of type BarCodeBuilder

            BarCodeBuilder builder = new BarCodeBuilder();

            // Set CodeText


    // Save the barcode image





my $barcode = new BarCode();