Sun Java System Message Queue 3.7 UR1 管理ガイド

Procedureサンプルアプリケーションを実行する

  1. 使用しているプラットフォームによって、次のいずれかのコマンドを使用し、HelloWorldmessageJNDI アプリケーションが格納されているディレクトリを現在のディレクトリにします。

    • Solaris の場合:


      cd /usr/demo/imq/helloworld/helloworldmessagejndi
    • Linux の場合:


      cd /opt/sun/mq/examples/helloworld/helloworldmessagejndi
    • Windows の場合:


      cd IMQ_HOME\\demo\\helloworld\\helloworldmessagejndi

    HelloWorldMessageJNDI.class ファイルが存在していることを確認してください。このアプリケーションを変更している場合は、『Message Queue Developer's Guide for Java Clients』に説明されているクライアントアプリケーションのコンパイルの手順を実行して、再コンパイルする必要があります。

  2. CLASSPATH 変数に HelloWorldMessageJNDI.class ファイルと Message Queue 製品に組み込まれた次の .jar ファイルを含む現在のディレクトリを追加します。


    jms.jar
    imq.jar
    jndi.jar
    fscontext.jar

    CLASSPATH 変数の設定方法については、『Message Queue Developer's Guide for Java Clients』を参照してください。


    注 –

    ファイル jndi.jar は JDK 1.4 にバンドルされています。それより前のバージョンの JDK を使用していないかぎり、CLASSPATH にこのファイルを追加する必要はありません。


  3. 使用しているプラットフォームによって、次のいずれかのコマンドを実行し、HelloWorldMessageJNDI アプリケーションを実行します。

    • Solaris または Linux の場合:


      % java HelloWorldMessageJNDI file:///tmp
    • Windows の場合:


      java HelloWorldMessageJNDI

    アプリケーションが問題なく実行されると、次 に示す出力が表示されるはずです。


    java HelloWorldMessageJNDI
    Using file:///C:/Temp for Context.PROVIDER_URL
    
    
    Looking up Queue Connection Factory object with lookup name:
    MyQueueConnectionFactory
    Queue Connection Factory object found.
    Looking up Queue object with lookup name: MyQueue
    Queue object found.
    
    
    Creating connection to broker.
    Connection to broker created.
    
    Publishing a message to Queue: MyQueueDest
    Received the following message: Hello World