• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Legible PATH and CLASSPATH

    January 24, 2007 Ted Holt

    Dear Professional:

    One of the things I don’t like about the Integrated File System (IFS) is its directory-based structure of untyped files. I consider the library system of strongly typed objects a much more robust architecture. Nevertheless, the IFS is reality and I have to deal with it. Here’s a short and simple tip for reading those ugly, almost indecipherable PATH and CLASSPATH variables we have to put up with.

    The PATH and CLASSPATH variables contain lists of directories, separated with colon characters. They function like library lists, in that the system searches the lists when looking for certain things. The PATH variable lists the directories that are to be searched when looking for files. The CLASSPATH variable lists the directories that are to be searched for Java classes. The longer these variables get, the uglier they get. Here’s an example of a relatively benign CLASSPATH.

    .:/Aps:/java/msbase.jar:/java/msutil.jar:
    /java/mssqlserver.jar:/qibm/ProdData/HTTP/Public/jt400/lib/jt400.jar

    A simple Qshell command gives CLASSPATH an air of civilization.

    echo $CLASSPATH | tr ":" "n"
    

    Here’s the result:

    .                                             
    /Aps                                          
    /java/msbase.jar                              
    /java/msutil.jar                              
    /java/mssqlserver.jar                         
    /qibm/ProdData/HTTP/Public/jt400/lib/jt400.jar
    

    So how does it work? The echo command writes the CLASSPATH value to standard output. The pipe (vertical bar) picks up echo’s output and passes it along to the tr (translate) utility, which converts colons to line-feed characters. The output goes to standard output, which in this case is a green-screen Qshell session.

    Want to make it even clearer? Number the lines!

    echo $CLASSPATH | tr ":" "n" | cat -n
    

    Here’s the numbered list:

    1  .                                             
    2  /Aps                                          
    3  /java/msbase.jar                              
    4  /java/msutil.jar                              
    5  /java/mssqlserver.jar                         
    6  /qibm/ProdData/HTTP/Public/jt400/lib/jt400.jar
    

    The second pipe feeds the output of tr to the cat utility, which displays the lines. The n switch tells cat to number the lines as it displays them.

    –Ted



                         Post this story to del.icio.us
                   Post this story to Digg
        Post this story to Slashdot

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Tags:

    Sponsored by
    Maxava

    Migrate IBM i with Confidence

    Tired of costly and risky migrations? Maxava Migrate Live minimizes disruption with seamless transitions. Upgrading to Power10 or cloud hosted system, Maxava has you covered!

    Learn More

    Share this:

    • Reddit
    • Facebook
    • LinkedIn
    • Twitter
    • Email

    Sponsored Links

    Computer Keyes:  Rapidly convert *SCS printer files into black and white or full color PDF documents
    Databorough:  X-analysis is the world leader in AS/400 application retro-documentation
    COMMON:  Join us at the 2007 conference, April 29 – May 3, in Anaheim, California

    Aras Delivers Open Source PLM Software The Vanishing IT Woman–System i Women Respond

    Leave a Reply Cancel reply

Volume 7, Number 3 -- January 24, 2007
THIS ISSUE SPONSORED BY:

SEQUEL
WorksRight Software
VAULT400

Table of Contents

  • Using the SQL SET OPTION Statement
  • Legible PATH and CLASSPATH
  • Admin Alert: Updating Your System i5 for Daylight Saving Time Changes

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Meet The Next Gen Of IBMers Helping To Build IBM i
  • Looks Like IBM Is Building A Linux-Like PASE For IBM i After All
  • Will Independent IBM i Clouds Survive PowerVS?
  • Now, IBM Is Jacking Up Hardware Maintenance Prices
  • IBM i PTF Guide, Volume 27, Number 24
  • Big Blue Raises IBM i License Transfer Fees, Other Prices
  • Keep The IBM i Youth Movement Going With More Training, Better Tools
  • Remain Begins Migrating DevOps Tools To VS Code
  • IBM Readies LTO-10 Tape Drives And Libraries
  • IBM i PTF Guide, Volume 27, Number 23

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle