ZFILE java: Launch a Java program from the command line

Use this command to launch a Java™ program from the command line on the z/TPF system.

Note: This is a UNIX-based command that is supported on the z/TPF system and the following information describes only z/TPF support. For more information about this command, see Running Java applications.

Last updated

  • Changed in 2024.
  • Added for PUT14.

Requirements and restrictions

  • On the z/TPF system, you must begin this UNIX-based command with ZFILE.
  • You can enter this command only when get file storage (GFS) is available.

Additional information

  • Online help information is available for this command. To display the help information, enter one of the following commands:
    • ZFILE java -help
    • ZFILE java -?
  • This command does not read from the standard input (stdin) stream.

    You can redirect the standard output (stdout) stream from the display terminal to a file by specifying one of the redirection characters (> or >>) followed by the file name that you want the output written to. The > character writes the output to a file. The >> character appends the output to an existing file.

    You can redirect the standard error (stderr) stream from the display terminal to a file by specifying one of the redirection characters (2> or 2>>) followed by the file name that you want the error output written to. The 2> character writes the error output to a file. The 2>> character appends the error output to an existing file.

    For example, the ZFILE dd command displays information from both stdin and stdout. You can use redirection to send the information from stderr to stdin, as well as redirect all of the contents of stdout to a file for storage. The following example converts the contents of a file to uppercase, redirects the number of bytes converted from stderr to stdin, and redirects all of the output from stdin to a file named test3.
    User:   zfile cat test1
    
    System: FILE0001I 14.26.32 START OF DISPLAY FROM cat test1
            this is a test
            END OF DISPLAY
    
    User:   zfile dd if=test1 conv=ucase >test3 2>&1
    
    System: FILE0003I 14.26.32 dd if=test1... COMPLETED SUCCESSFULLY. NO OUTPUT TO DISPLAY
    
    User:   zfile cat test3
    
    System: FILE0001I 14.26.32 START OF DISPLAY FROM cat test3
            THIS IS A TEST
            0.1 records in
            0.1 records out
            15 bytes transferred in 1 secs (15 bytes/sec)
            END OF DISPLAY
    Note: When you use the > or 2> character and the file that you are redirecting data to already exists, the file is overwritten and any data in that file is lost. If you do not want to overwrite the file, ensure that you use the >> or 2>> character.
  • You can use a vertical bar, or pipe (|), to direct data so that the output from one process becomes the input to another process. This type of one-way communication allows you to combine ZFILE commands on one line to create a pipeline. For example, the following pipeline uses the standard output (stdout) stream from the ZFILE ls command and redirects it to the standard input (stdin) stream of the ZFILE grep command to search for those lines containing the word Jan.
    ZFILE ls -l | grep Jan
    The result is filtered output from the ZFILE ls command displaying only the lines containing the word Jan in any position.

    You can use pipes only with a combination of ZFILE commands where the command on the left side of the pipe provides data through stdout and the right side accepts data through stdin.

Examples

The following example prints the product version and exits.
User:   zfile java -version
System: CSMP0097I 20.10.14 CPU-B SS-BSS  SSU-HPN  IS-01
        FILE0002I 20.10.14 START OF ERROR DISPLAY FROM java -version
        java version "11.0.21" 2023-10-17
        IBM Semeru Runtime Certified Edition for z/TPF (build 11.0.21.0)
        Eclipse OpenJ9 VM (build ibm-jdk11-zTPF-11.0.21-e894e8a3eb5, JRE 11 TPF s390x-64-Bit 20231208_000000 (JIT enabled, AOT enabled)
        OpenJ9   - e894e8a3eb5
        OMR      - 9960cb6fd
        OpenJ9      - 1b0232b
        JCL      - 0e3f7bdf15 based on jdk-11.0.21.9)
        END OF DISPLAY
The following example calls the CopyRemote application to copy the /usr/public/test.txt file from the local directory to the remote system. The specified class path on the command line is used to search for the Java program.
User:   zfile java -cp .:$MYCLASSPATH CopyRemote 9.57.13.126 /usr/public/test.txt 1

System: CSMP0097I 11.50.10 CPU-B SS-BSS  SSU-HPN  IS-01
        FILE0001I 11.50.10 START OF DISPLAY FROM java -cp .:$MYCLASSPATH CopyRemote ...
        File to retrieve /usr/public/test.txt
        Remote system is UNIX Type: L8
        Current directory is /tmp
        END OF DISPLAY+