Sidebar

The AS/400 Toolbox for Java Tutorial

Java
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

The AS/400 Toolbox for Java provides an easy entry into the Java environment. It allows a Java program to access AS/400 data, commands, or programs, and it handles all the work needed to sign on to an AS/400, even managing the connection. Getting started with the AS/400 Toolbox for Java is easy. The product is available as part of the AS/400 offering and the VisualAge for Java offering. You can also get it from the AS/400 Toolbox for Java home page. Once you have the product, you need to determine the Java environment you want to use (applications, applets, or servlets) and then set up your AS/400 and workstation. This article provides information to help you determine the right Java environment for you as well as the installation instructions you need to get set up and started.

IBM’s AS/400 Toolbox for Java is a set of Java classes that allow a Java program to access AS/400 data, commands, or programs. The support provided by these classes is similar to the type of functions provided in the IBM’s Client Access/400 APIs. However, the AS/400 Toolbox for Java does not require Client Access support in order to work. It only requires a Java Virtual Machine (JVM) at runtime and the Java Developer Kit (JDK) at development time.

The AS/400 Toolbox for Java consists of over 300 classes. These classes (which are delivered as a Java package in a compressed file) do all the work that allows a Java application to access and sign on to an AS/400, including managing the connection. The product also includes support for making a command call, making a program call, or accessing the AS/400 database using Java Database Connectivity (JDBC) or record-level access, just to name a few. The classes use the existing AS/400 servers as entry points into the system. Each server runs in a separate job on the AS/400 and sends and receives data streams on a socket connection.

The AS/400 Toolbox for Java provides an easy entry into the Java environment because it uses applications and data that already exist on the AS/400. It allows you to move data between the AS/400 and a Java program running on the AS/400, a Java program

running on a workstation, a Java applet running in a Java-enabled browser, or a Java servlet running on a Java-enabled server such as the AS/400 (available as of V4R3). It is also certified 100% Pure Java, which ensures that all of its classes will run on any JVM.

What Do I Need and Where Do I Find It?

The AS/400 Toolbox for Java is available as part of the AS/400 offering, as part of the Visual Age for Java product offering, or through the AS/400 Toolbox for Java home page.

A table listing the AS/400 and VisualAge for Java releases and the level of AS/400 Toolbox for Java available is shown in Figure 1.

The AS/400 Toolbox for Java home page is located at www.as400.ibm.com/toolbox. From the home page, you can download a trial version, participate in the current beta offering, obtain the latest programmer guide, browse through the latest AS/400 COMMON labs, or use the interactive demo.

Using .jar and .zip Files

The AS/400 Toolbox for Java product contains both a .zip and a .jar file (jt400.zip and jt400.jar). .jar files provide a way to group class files and resources needed by beans or applets. It has the same format as a .zip file, including the ability to compress the files. However, a .jar file may contain the file types .class (compiled Java byte code), .ser (serialized beans), .gif (images), or any other type of file that could be used by the bean. Simply put, a .jar file contains all the files a JavaBean requires.

The AS/400 Toolbox for Java .zip and .jar files contain the same files. Unless the environment you are using does not support .jar files (such as Java 1.0), it is recommended that you try using the .jar file.

As the number of functions provided by the AS/400 Toolbox for Java increases, so do the sizes of the .zip and .jar files. In order to reduce that size, the AS/400 Toolbox for Java now provides a JarMaker function. Even though it is called JarMaker, it works on both .zip and .jar files.

JarMaker provides the ability to create a smaller .jar or .zip file from a larger one. In addition, JarMaker can unzip a .zip or .jar file and provide user access to the individual files. It is currently available from AS/400 Toolbox for Java home page previously listed.

JarMaker can be invoked from within a Java program or used as a standalone program. It is a client-based tool that can be used wherever the JVM and Jarmaker are located. To split jt400.jar into a set of 300K files, enter the following command:

java utilities.AS400ToolboxJarMaker -split 300

To create a .jar file containing only the Toolbox classes needed to use the command call and program call functions, enter this command:

java utilities.AS400ToolboxJarMaker -component CommandCall, ProgramCall

Setting Up and Installing the AS/400 Toolbox for Java

Depending on the version of AS/400 Toolbox for Java you are using, different OS/400 releases, JDKs, and Java Swing levels are supported (see Figure 2). Note that Java Swing refers to a package of Java classes that were developed by Sun to provide advanced GUI components. The Swing classes can be downloaded for free at java.sun.com/products/ jfc/index.html.

Prior to installing the AS/400 Toolbox for Java, you need to determine where you want to install it, what you need to install on your workstation, and what you need to install on your AS/400. You may want to install the AS/400 Toolbox for Java on your workstation, on your AS/400, or both. That decision should be based on whether you are using applications, applets, or servlets.

As stated earlier, the AS/400 Toolbox for Java classes allow users to access the AS/400 using applications, applets, or servlets. Depending on your specific needs, you may use any or all of these items.

Applications

An application is a Java program that can run standalone or outside of a Web browser. It can be run from any workstation or server that has a JVM. Applications are used for non-Web environments. If you are using applications, the AS/400 Toolbox for Java can be installed on the workstation or the AS/400 server. It depends on where the application is going to be run, administration costs, and performance issues. If you have several workstations and each of them has its own copy, then there is an administration cost every time updates need to be made. However, by having the class library on the workstation, there are no performance penalties due to traffic on the communications line. The advantage of having the product on the server is that there is only one copy to update, but there is a performance cost to pay due to traffic on the communications line. However, the performance cost for this scenario is considered minor.

Applets

An applet is a Java program that runs on a Java-enabled Web browser. In other words, it works from the Web pages. Just like applications, the class files can be kept on the workstation or the server. The same considerations that apply to application class file location apply when determining where the class files for applets should be installed. However, when using applets, the performance penalty may be more significant due to the browser. The performance impact will also depend on the number of classes that need to be downloaded and the number of connections that need to be made during that time.

Servlets

A servlet is a Java program that runs on a server and returns HTML to the Web browser. Servlets are invoked by an HTML server. They should be used if you want the processing to occur on the server and the information sent back to the browser. The advantage of using a servlet is that the program runs on the server: The only data that goes over the communication lines is the HTML, thus eliminating the performance impact issue. When using servlets, the class files must be installed on the server.

Workstation Requirements

To use the AS/400 Toolbox for Java classes from workstation-based Java applications, your machine must have several other pieces of software installed. First, it will need a JVM that is at the appropriate level based on the version of AS/400 Toolbox for Java being used (see Figure 2). Second (if you are planning to use the GUI classes), it will need Sun’s Swing package installed. And third, that workstation will have to have TCP/IP installed and configured.

To use the AS/400 Toolbox for Java classes from within Java applets, each workstation will require a browser that supports the appropriate level of JDK. Again, if you are planning to use the GUI classes, for best results, that browser should also support Sun’s Swing classes, and these classes should be installed on the client system. The Swing classes can be dynamically downloaded to the browser but only at a severe performance cost.

OS/400 Requirements

To use the AS/400 Toolbox for Java classes from within host-based AS/400 applications, your AS/400 must have several software products installed:

• The level of OS/400 required, based on the version of the AS/400 Toolbox for Java being used

• The Host Servers option of OS/400
• The TCP/IP Connectivity Utilities for AS/400 licensed program, 5769-TC1 With the appropriate software products installed, there are a few extra steps that must be done as well. The QUSER profile must be enabled and have a valid password. You can use the Work User Profile (WRKUSRPRF) command to check this:

WRKUSRPRF USRPRF(QUSER)

Also, the host servers must be started. The Start Host Servers (STRHOSTSVR) command specifying an option of ALL handles this requirement:

STRHOSTSVR *ALL

Finally, if you have OS/400 Version 4, Release 2 or later and plan to use record- level database access, you also need to start the distributed data management (DDM) server. The Start TCP Server (STRTCPSVR) command with the specification of DDM is used to enable record-level access:

STRTCPSVR *DDM

Installing the AS/400 Toolbox for Java on the AS/400

To install the AS/400 Toolbox for Java licensed program on the AS/400, enter the Restore License Program (RSTLICPGM) command. The AS/400 Toolbox for Java is license program number 5763JC1.

Placing the AS/400 Toolbox for Java Class Files on Your Workstation

Copying the class files to your workstation allows you to serve the files from your workstation.

Either the jt400.zip file or the jt400.jar file can be used on your workstation and are located on the Integrated File System (IFS) of the AS/400 in directory /QIBM/ProdData/HTTP/Public/jt400/lib.

You can chose to manually copy the .zip or .jar file from the AS/400 to your workstation by using Client Access to map a network drive or by using file transfer protocol (FTP). If using FTP, be sure the file is transferred in binary mode. You may also use the AS400ToolboxInstaller class to copy the files to your workstation. The AS400ToolboxInstaller class provides a set of APIs that install and update the AS/400 Toolbox for Java classes onto the client. The AS400ToolboxInstaller class is not a standalone application; it is a class that is intended to be a part of a Java program.

Once the files are copied to the workstation, the CLASSPATH environment on the workstation needs to be updated with the location of where you put the .zip and .jar files. So, for example, on a PC that is using the Windows 95 operating system, if jt400.jar resides in C:jt400libjt400.jar, that path needs to be added to the CLASSPATH variable. The following DOS set command appends the example path to the existing CLASSPATH much like an Add Library List Entry (ADD-LIBLE) command:

SET CLASSPATH=%CLASSPATH%C:jt400libjt400.zip

Once you have installed the AS/400 Toolbox for Java product, it is recommended that you go through the COMMON labs, which are available from the AS/400 Toolbox for Java home page. These labs will walk you through how to use the most popular functions.

The AS/400 Toolbox for Java is an easy way to become part of the Java world. Whether you want to use Java applications, applets, or servlets, this product can get you on your way to using Java with your existing AS/400 programs and data.

AS/400 Release Version of AS/400 Toolbox for Java

OS/400 Version 4 Release 2 Mod 0 OS/400 Version 4 Release 3 Mod 1 Visual Age for Java Release (Enterprise Edition ONLY)

Version 1.0 Not available Version 1.0.1 Mod 0 Version 1.0.0 (AS/400 Fix Pack) Mod 0 Version 2.0 (U.S. English) Mod 1 Version 2.0 (NL Version) Mod 1

Figure 1: Releases of AS/400 Toolbox for Java

AS/400 Toolbox OS/400 Releases Supported JDK Required Java Swing Level for Java Release Required
Mod 0 V3R2, V3R7, V4R1, V4R2 JDK 1.1.2 or later None
Mod 1 V3R2, V4R1, V4R2, V4R3 JDK 1.1.5 or later 1.0.2 or later

Figure 2: The toolbox’s release levels have different OS/400, JDK, and Sun’s Swing package support requirements

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

RESOURCE CENTER

  • WHITE PAPERS

  • WEBCAST

  • TRIAL SOFTWARE

  • White Paper: Node.js for Enterprise IBM i Modernization

    SB Profound WP 5539

    If your business is thinking about modernizing your legacy IBM i (also known as AS/400 or iSeries) applications, you will want to read this white paper first!

    Download this paper and learn how Node.js can ensure that you:
    - Modernize on-time and budget - no more lengthy, costly, disruptive app rewrites!
    - Retain your IBM i systems of record
    - Find and hire new development talent
    - Integrate new Node.js applications with your existing RPG, Java, .Net, and PHP apps
    - Extend your IBM i capabilties to include Watson API, Cloud, and Internet of Things


    Read Node.js for Enterprise IBM i Modernization Now!

     

  • Profound Logic Solution Guide

    SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation.
    Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects.
    The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the companyare not aligned with the current IT environment.

    Get your copy of this important guide today!

     

  • 2022 IBM i Marketplace Survey Results

    Fortra2022 marks the eighth edition of the IBM i Marketplace Survey Results. Each year, Fortra captures data on how businesses use the IBM i platform and the IT and cybersecurity initiatives it supports.

    Over the years, this survey has become a true industry benchmark, revealing to readers the trends that are shaping and driving the market and providing insight into what the future may bring for this technology.

  • Brunswick bowls a perfect 300 with LANSA!

    FortraBrunswick is the leader in bowling products, services, and industry expertise for the development and renovation of new and existing bowling centers and mixed-use recreation facilities across the entertainment industry. However, the lifeblood of Brunswick’s capital equipment business was running on a 15-year-old software application written in Visual Basic 6 (VB6) with a SQL Server back-end. The application was at the end of its life and needed to be replaced.
    With the help of Visual LANSA, they found an easy-to-use, long-term platform that enabled their team to collaborate, innovate, and integrate with existing systems and databases within a single platform.
    Read the case study to learn how they achieved success and increased the speed of development by 30% with Visual LANSA.

     

  • Progressive Web Apps: Create a Universal Experience Across All Devices

    LANSAProgressive Web Apps allow you to reach anyone, anywhere, and on any device with a single unified codebase. This means that your applications—regardless of browser, device, or platform—instantly become more reliable and consistent. They are the present and future of application development, and more and more businesses are catching on.
    Download this whitepaper and learn:

    • How PWAs support fast application development and streamline DevOps
    • How to give your business a competitive edge using PWAs
    • What makes progressive web apps so versatile, both online and offline

     

     

  • The Power of Coding in a Low-Code Solution

    LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks

     

     

  • Why Migrate When You Can Modernize?

    LANSABusiness users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
    In this white paper, you’ll learn how to think of these issues as opportunities rather than problems. We’ll explore motivations to migrate or modernize, their risks and considerations you should be aware of before embarking on a (migration or modernization) project.
    Lastly, we’ll discuss how modernizing IBM i applications with optimized business workflows, integration with other technologies and new mobile and web user interfaces will enable IT – and the business – to experience time-added value and much more.

     

  • UPDATED: Developer Kit: Making a Business Case for Modernization and Beyond

    Profound Logic Software, Inc.Having trouble getting management approval for modernization projects? The problem may be you're not speaking enough "business" to them.

    This Developer Kit provides you study-backed data and a ready-to-use business case template to help get your very next development project approved!

  • What to Do When Your AS/400 Talent Retires

    FortraIT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators is small.

    This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:

    • Why IBM i skills depletion is a top concern
    • How leading organizations are coping
    • Where automation will make the biggest impact

     

  • Node.js on IBM i Webinar Series Pt. 2: Setting Up Your Development Tools

    Profound Logic Software, Inc.Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. In Part 2, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Attend this webinar to learn:

    • Different tools to develop Node.js applications on IBM i
    • Debugging Node.js
    • The basics of Git and tools to help those new to it
    • Using NodeRun.com as a pre-built development environment

     

     

  • Expert Tips for IBM i Security: Beyond the Basics

    SB PowerTech WC GenericIn this session, IBM i security expert Robin Tatam provides a quick recap of IBM i security basics and guides you through some advanced cybersecurity techniques that can help you take data protection to the next level. Robin will cover:

    • Reducing the risk posed by special authorities
    • Establishing object-level security
    • Overseeing user actions and data access

    Don't miss this chance to take your knowledge of IBM i security beyond the basics.

     

     

  • 5 IBM i Security Quick Wins

    SB PowerTech WC GenericIn today’s threat landscape, upper management is laser-focused on cybersecurity. You need to make progress in securing your systems—and make it fast.
    There’s no shortage of actions you could take, but what tactics will actually deliver the results you need? And how can you find a security strategy that fits your budget and time constraints?
    Join top IBM i security expert Robin Tatam as he outlines the five fastest and most impactful changes you can make to strengthen IBM i security this year.
    Your system didn’t become unsecure overnight and you won’t be able to turn it around overnight either. But quick wins are possible with IBM i security, and Robin Tatam will show you how to achieve them.

  • Security Bulletin: Malware Infection Discovered on IBM i Server!

    SB PowerTech WC GenericMalicious programs can bring entire businesses to their knees—and IBM i shops are not immune. It’s critical to grasp the true impact malware can have on IBM i and the network that connects to it. Attend this webinar to gain a thorough understanding of the relationships between:

    • Viruses, native objects, and the integrated file system (IFS)
    • Power Systems and Windows-based viruses and malware
    • PC-based anti-virus scanning versus native IBM i scanning

    There are a number of ways you can minimize your exposure to viruses. IBM i security expert Sandi Moore explains the facts, including how to ensure you're fully protected and compliant with regulations such as PCI.

     

     

  • Encryption on IBM i Simplified

    SB PowerTech WC GenericDB2 Field Procedures (FieldProcs) were introduced in IBM i 7.1 and have greatly simplified encryption, often without requiring any application changes. Now you can quickly encrypt sensitive data on the IBM i including PII, PCI, PHI data in your physical files and tables.
    Watch this webinar to learn how you can quickly implement encryption on the IBM i. During the webinar, security expert Robin Tatam will show you how to:

    • Use Field Procedures to automate encryption and decryption
    • Restrict and mask field level access by user or group
    • Meet compliance requirements with effective key management and audit trails

     

  • Lessons Learned from IBM i Cyber Attacks

    SB PowerTech WC GenericDespite the many options IBM has provided to protect your systems and data, many organizations still struggle to apply appropriate security controls.
    In this webinar, you'll get insight into how the criminals accessed these systems, the fallout from these attacks, and how the incidents could have been avoided by following security best practices.

    • Learn which security gaps cyber criminals love most
    • Find out how other IBM i organizations have fallen victim
    • Get the details on policies and processes you can implement to protect your organization, even when staff works from home

    You will learn the steps you can take to avoid the mistakes made in these examples, as well as other inadequate and misconfigured settings that put businesses at risk.

     

     

  • The Power of Coding in a Low-Code Solution

    SB PowerTech WC GenericWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed.
    Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

    • Discover the benefits of Low-code's quick application creation
    • Understand the differences in model-based and language-based Low-Code platforms
    • Explore the strengths of LANSA's Low-Code Solution to Low-Code’s biggest drawbacks

     

     

  • Node Webinar Series Pt. 1: The World of Node.js on IBM i

    SB Profound WC GenericHave you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.
    Part 1 will teach you what Node.js is, why it's a great option for IBM i shops, and how to take advantage of the ecosystem surrounding Node.
    In addition to background information, our Director of Product Development Scott Klement will demonstrate applications that take advantage of the Node Package Manager (npm).
    Watch Now.

  • The Biggest Mistakes in IBM i Security

    SB Profound WC Generic The Biggest Mistakes in IBM i Security
    Here’s the harsh reality: cybersecurity pros have to get their jobs right every single day, while an attacker only has to succeed once to do incredible damage.
    Whether that’s thousands of exposed records, millions of dollars in fines and legal fees, or diminished share value, it’s easy to judge organizations that fall victim. IBM i enjoys an enviable reputation for security, but no system is impervious to mistakes.
    Join this webinar to learn about the biggest errors made when securing a Power Systems server.
    This knowledge is critical for ensuring integrity of your application data and preventing you from becoming the next Equifax. It’s also essential for complying with all formal regulations, including SOX, PCI, GDPR, and HIPAA
    Watch Now.

  • Comply in 5! Well, actually UNDER 5 minutes!!

    SB CYBRA PPL 5382

    TRY the one package that solves all your document design and printing challenges on all your platforms.

    Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product.

    Request your trial now!

  • Backup and Recovery on IBM i: Your Strategy for the Unexpected

    FortraRobot automates the routine tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:
    - Simplified backup procedures
    - Easy data encryption
    - Save media management
    - Guided restoration
    - Seamless product integration
    Make sure your data survives when catastrophe hits. Try the Robot Backup and Recovery Solution FREE for 30 days.

  • Manage IBM i Messages by Exception with Robot

    SB HelpSystems SC 5413Managing messages on your IBM i can be more than a full-time job if you have to do it manually. How can you be sure you won’t miss important system events?
    Automate your message center with the Robot Message Management Solution. Key features include:
    - Automated message management
    - Tailored notifications and automatic escalation
    - System-wide control of your IBM i partitions
    - Two-way system notifications from your mobile device
    - Seamless product integration
    Try the Robot Message Management Solution FREE for 30 days.

  • Easiest Way to Save Money? Stop Printing IBM i Reports

    FortraRobot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing.
    Manage your reports with the Robot Report Management Solution. Key features include:

    - Automated report distribution
    - View online without delay
    - Browser interface to make notes
    - Custom retention capabilities
    - Seamless product integration
    Rerun another report? Never again. Try the Robot Report Management Solution FREE for 30 days.

  • Hassle-Free IBM i Operations around the Clock

    SB HelpSystems SC 5413For over 30 years, Robot has been a leader in systems management for IBM i.
    Manage your job schedule with the Robot Job Scheduling Solution. Key features include:
    - Automated batch, interactive, and cross-platform scheduling
    - Event-driven dependency processing
    - Centralized monitoring and reporting
    - Audit log and ready-to-use reports
    - Seamless product integration
    Scale your software, not your staff. Try the Robot Job Scheduling Solution FREE for 30 days.