How to run a jms-class as a stand-alone java-Programm???

Hi,
I have another little question concerning jms. The jms programs I have written so far had to be executed
as application clients using the appclient-tool. I asked myself, if it is possible to run a class
that uses jms like a normal java-Programm with the java-command.
Unfortunately, an exception is thrown then, because there is no initial context for the JNDI
lookup. Is there a work around to this problem??
THANKS.

can you write more concretely where I can find the solution to this problem??

Similar Messages

  • How to run a JMS client

    I have an .ear file which contains an application which publishes a message to a JMS topic that I had developed and used on Websphere. With Webshpere the launchClient utility was used to run the .ear file. Is there something similar in WebLogic that I can use?
              Otherwise, how do I go about running an application liek this that needs to connect to the server and publish to JMS topics?
              Sorry, I'm new to this stuff.
              Thanks!

    Thanks again for the response.
              Nope that's not quite it... the .ear file I have does not have any J2EE contained objects like session beans or EJBs at all. It is a straight stand-alone java application.
              When I ran it for Websphere I had to use a utility provided by IBM that launches the .ear as a client called "launchClient" - some sort of thin client wrapper.
              So my question is, how do I run a stand-alone java application that runs outside of the server? Can I run it in .ear form or do I have to extract out the classes/make a .jar file - what is the command line syntax - i.e. is there a similar utility for weblogic or do i have to jsut run it via the java command with some specialized runtime parameters.
              Hope this clears up the confusion and thanks again for helping me out - I appreciate it!!!
              -Kevin

  • Database connection pool to stand alone java class

    Hi all,
    I would like to know the best way to use a database connection pool with a stand alone java class.
    In my web applications I usually use JDBC Data Source version 5 to connect to my database. In this case, I connect to an Oracle database. But in this scene, I've a WebSphere Application Server to provide this connection pool. But for stand alone applications, I don't know how to do because I don't have a Application server to run on.
    Can enyone help me with this beginner question?
    Best regards.

    I tried to find the pool class I created but it must be on another CD. Anyway, you can easily create a number of connections and place them on a stack (your own or java's). When you need one, pop it off. When you are finished, push it back.
    Good luck.

  • Calling a web service from a stand alone java class

    I need to invoke a web service from stand alone java class- Please let me know how to acheive this.
    Thanks

    Hi jazz123,
    There's an example in the [*Java Web Services Tutorial*|http://java.sun.com/webservices/docs/2.0/tutorial/doc/] : see Chapter 1: Building Web Services with JAX-WS - A Simple JAX-WS Client.

  • How to call stand Alone java program from jsp

    Hello all...
    I want to use the stand alone java program in jsp page. I compiled the java program and place the class file in classes folder under web-inf. But when i try to instantiate the java class inside jsp it is not recognizing the class. Where might be the problem
    Plz help....
    Shamim

    hi , this is dheeraj.. i need to know that how to execute java code and class in jsp.. if anyone know about if bt tell me.. i just know that we can use java code by java beans in jsp.. if you know any knowledge regarding this topic please send me.....

  • Calling a web service through SSL via a stand alone java class

    HI,
    I am trying to call a web service through SSL via a simple stand alone java client.
    I have imported the SSL certificate in my keystore by using the keytool -import command.
    Basically I want to add a user to a group on the server. Say I add a user user 1 to group group 1 using an admin userid and password. All these values are set in an xml file which I send to the server while calling the server. I pass the web service URL, the soap action name and the xml to post as the command line arguments to the java client.
    My xml file(Add.xml) that is posted looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:xsi = "http://www.w3.org/1999/XMLSchema-instance"
    xmlns:SOAP-ENC = "http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV = "http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsd = "http://www.w3.org/1999/XMLSchema"
    SOAP-ENV:encodingStyle = "http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
    <namesp1:modifyGroupOperation xmlns:namesp1 = "/services/modifyGroup/modifyGroupOp">
    <auth>
    <user>adminUser</user>
    <password>adminPassword</password>
    </auth>
    <operationType>ADD</operationType>
    <groupName>group1</groupName>
    <users>
    <userName>user1</userName>
    </users>
    </namesp1:modifyGroupOperation>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    I call the client as:
    java PostXML https://com.webservice.com/services/modifyGroup "/services/modifyGroup/modifyGroupOp" Add.xml
    I my client, I have set the following:
    System.setProperty("javax.net.ssl.keyStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.keyStorePassword", "password");
    System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\jre1.5.0_12\\lib\\security\\cacerts");
    System.setProperty("javax.net.ssl.trustStorePassword", "password");
    But when I try to execute the java client, I get the following error:
    setting up default SSLSocketFactory
    use default SunJSSE impl class: com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl is loaded
    keyStore is : C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    keyStore type is : jks
    keyStore provider is :
    init keystore
    init keymanager of type SunX509
    trustStore is: C:\Program Files\Java\jre1.5.0_12\lib\security\cacerts
    trustStore type is : jks
    trustStore provider is :
    init truststore
    adding as trusted cert:
    init context
    trigger seeding of SecureRandom
    done seeding SecureRandom
    instantiated an instance of class com.sun.net.ssl.internal.ssl.SSLSocketFactoryImpl
    main, setSoTimeout(0) called
    main, setSoTimeout(0) called
    %% No cached client session
    *** ClientHello, TLSv1
    RandomCookie: GMT: .....
    Compression Methods: { 0 }
    [write] MD5 and SHA1 hashes: len = 73
    main, WRITE: TLSv1 Handshake, length = 73
    [write] MD5 and SHA1 hashes: len = 98
    main, WRITE: SSLv2 client hello message, length = 98
    [Raw write]: length = 100
    [Raw read]: length = 5
    [Raw read]: length = 58
    main, READ: TLSv1 Handshake, length = 58
    *** ServerHello, TLSv1
    %% Created: [Session-1, SSL_RSA_WITH_RC4_128_MD5]
    ** SSL_RSA_WITH_RC4_128_MD5
    [read] MD5 and SHA1 hashes: len = 58
    [Raw read]: length = 5
    [Raw read]: length = 5530
    main, READ: TLSv1 Handshake, length = 5530
    *** Certificate chain
    chain [0] = ...
    chain [1] = ...
    chain [2] = ...
    chain [3] = ...
    main, SEND TLSv1 ALERT: fatal, description = certificate_unknown
    main, WRITE: TLSv1 Alert, length = 2
    [Raw write]: length = 7
    0000: 15 03 01 00 02 02 2E .......
    main, called closeSocket()
    main, handling exception: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    main, called close()
    main, called closeInternal(true)
    Exception in thread "main" javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.c
    ertpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:506)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2110)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1088)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at PostXML.main(PostXML.java:111)
    Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find v
    alid certification path to requested target
    at sun.security.validator.PKIXValidator.doBuild(Unknown Source)
    at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)
    at sun.security.validator.Validator.validate(Unknown Source)
    at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)
    at com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown Source)
    ... 18 more
    Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
    at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)
    at java.security.cert.CertPathBuilder.build(Unknown Source)
    ... 23 more
    I do not know where I have gone wrong. Could someone point out my mistake.
    Thanks In advance!

    Hi jazz123,
    There's an example in the [*Java Web Services Tutorial*|http://java.sun.com/webservices/docs/2.0/tutorial/doc/] : see Chapter 1: Building Web Services with JAX-WS - A Simple JAX-WS Client.

  • How to call a stand alone java application from ADF BC JSP, struts or JSF

    Hi,
    My requirement is that there are utilities or stand alone java applications that I want to call from our existing applications.
    We have two seperate applications one ADF BC Struts application we developed using JDeveloper 10.1.2 and another ADF BC JSF application we developed using JDeveloper 10.1.3.2.
    We want to integrate applications like JTwain and others to help us in scanning. The application will be placed on the same server as our application. How can I do this without loosing all the current session information.
    Please help.
    Thanks and regards,

    There are two possible solutions.
    First, if the tool or application you want to integrate, has an Java-API you can use this api and integrate the tool in your application (using one or more jars you add to the classpath).
    Second, if the tool has no java api, you can call the tool via runtime.exec(...) as a shell process. This way you open a command shell in you application and execute the tool like you do on a normal command shell.
    For tide integration and control I recommend the first approach. The second one is only for those tools which don't offer a java api.
    Timo

  • Basic Setting required for running simple JMS class

    please tell me all setting required for running JMS class.
    I have installed IBM MQSeries.
    Especially about how to lookup for Topic and TopicConnectionFactory and where should i specify.
    it is very urgent please help me fast. Also send any files for doing setting to me at [email protected]

    Context ctx = null;
    Hashtable ht = new Hashtable();
    ht.put(Context.INITIAL_CONTEXT_FACTORY," "); //put yor init. context
    ht.put(Context.PROVIDER_URL, " "); //put your server url
    ctx = new InitialContext(ht);
    TopicConnectionFactory topicConnectionFactory = (TopicConnectionFactory) ctx.lookup(" "); // your connection factory
    TopicConnection tcon = topicConnectionFactory.createTopicConnection();
    TopicSession tsession = tcon.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
    Topic topic = (Topic) ctx.lookup(" "); // This is your topic
    TopicSender tsender = tsession.createSender(topic);
    TextMessage message = tsession.createTextMessage();
    message.setText("Topic Message");

  • Is anyone know how to run the examples in 3d user interfaces with java 3d

    hi dear ,
    I am trying to run the examples in 3d user interfaces with java 3d.
    I hope i can load the library in jcreator. but the libarary for this book are classes files , it do not have jar file for it . the jcreator do not read these classes . i do not know why ? i am wonder if there any one run these code before can give me some idear .
    thanks so much .
    the code u can get from this link.
    http://www.manning.com/books/barrilleaux/source
    thank you for u to have a look for me .
    regards
    xiaocui

    <h2>{color:red}CROSS POSTED{color}</h2>
    [t-5289810]
    Cross posting is rude.
    db

  • Running stand alone java class using Maven

    Hi I want to run my main class using Maven.Can anyone help?

    SDET wrote:
    Hi I want to run my main class using Maven.Can anyone help?I'm pretty sure the Maven documentation can be of great help. If not, the Maven-users mailing list is your resource of choice for Maven related questions.

  • Accessing JMS Queue located in stand alone managed server on same domain

    Our use-case is as follows.
    In our weblogic domain we have SOA_Cluster and a stand alone managed server. All the custom JMS resources belong to a JMS server that is targeted to stand alone JMS server. We are trying to access JMS Queues/Topics located in the stand alone managed server from JMS adapter (part of SOA Cluster).
    I am wondering what should be our adapter configuration in this scenario. In going through JMS adapter use-cases (below is the link), there is a mention of how to access resources located in Remote weblogic Domain. I am wondering if the same applies to us OR if there is better way to access JMS resources for our use case.
    http://download.oracle.com/docs/cd/E14571_01/integration.1111/e10231/adptr_jms.htm#CJAHAFGF
    Appreciate your feedback.

    Accessing JMS Queue/Topic located in different Managed server on same domai
    Regards,
    Anuj

  • How to refer to root class from a package in Java 1.4

    Hi
    I have written a class at root level and it is being called be a different class which is defined in a package, when I am trying to import base class it is giving compilation error in Java 1.4.0 and Java 1.4.1 version but code work fine with java 1.2.2
    For you reference here is sample code
    First class AddNumbers defined at root
    public class AddNumbers{
         int iResult=0;
         public AddNumbers(int a, int b){
              iResult= a+b;
         public int getSum(){
              return iResult;
    second class PlayNumbers is defined in package TreeTest
    package TreeTest;
    import AddNumbers;
    public class PlayNumbers{
         int iNum1 =5;
         int iNum2 = 10;
         int iRes;
         public PlayNumbers(){
              AddNumbers ad = new AddNumbers(iNum1,iNum2);
              iRes = ad.getSum();
              System.out.println("Result is ="+iRes);
    public static void main(String [] arg){
              new PlayNumbers();
    Could anyone suggest how to invoke AddNumbers class in JDK1.4.1
    Thanks
    AKM

    The root package should never have been automatically included for compilation purposes.
    In order to access a class in the root package import it as you should for any other class.
    import AddNumbers;
    is the proper way to do this.
    The only time you don't need to use an import statement is if the class you wish to reference is in the same package as the class that refers to it. Again, you should really import such classes as it makes things explicitly clear which classes you are referring to.

  • How to access the parent class variable or object in java

    Hi Gurus,
    I encounter an issue when try to refer to parent class variable or object instance in java.
    The issue is when the child class reside in different location from the parent class as shown below.
    - ClassA and ClassB are reside in xxx.oracle.apps.inv.mo.server;
    - Derived is reside in xxx.oracle.apps.inv.mo.server.test;
    Let say ClassA and ClassB are the base / seeded class and can not be modified. How can i refer to the variable or object instance of ClassA and ClassB inside Derived class.
    package xxx.oracle.apps.inv.mo.server;
    public class ClassA {
        public int i=10;
    package xxx.oracle.apps.inv.mo.server;
    public class ClassB extends ClassA{
        int i=20;   
    package xxx.oracle.apps.inv.mo.server.test;
    import xxx.oracle.apps.inv.mo.server.ClassA;
    import xxx.oracle.apps.inv.mo.server.ClassB;
    public class Derived extends ClassB {
        int i=30;
        public Derived() {
           System.out.println(this.i);                  // this will print 30
           System.out.println(((ClassB)this).i);  // error, but this will print 20 if Derived class located in the same location as ClassB
           System.out.println(((ClassA)this).i);  // error, but this will print 20 if Derived class located in the same location as ClassA
        public static void main(String[] args) { 
            Derived d = new Derived(); 
    Many thanks in advance,
    Fendy

    Hi ,
    You cannot  access the controller attribute instead create an instance of the controller class and access the attribute in the set method
    OR create a static method X in the controller class and store the value in that method. and you can access the attribute by 
    Call method class=>X
    OR if the attribute is static you can access by classname=>attribute.
    Regards,
    Gangadhar.S
    Edited by: gangadhar rao on Mar 10, 2011 6:56 AM

  • Having Problem With "static" When Running a Stand Alone Java Class

    I have a Java class that recursively builds a 'tree' . This Java class works as I expected without problem. I am able to write out this 'tree" to the console "line by line" with proper indentation.
    The problem occurs when I try to iterate through this 'tree' in the public static void main(String[] arg) method -- Each line in the tree is an Array. And I have to declare this Array (called titleArray in my code) non-static; otherwise, I end up with picking up the very last line of my hard-coded data.
    Besides, I also have to declare the List (called recursiveTextArray in my code) non-static; otherwise, I end up with picking up the first Array that I ever build and run into endless iterations till the heap size is exhausted. Note that each element of that List is an Array object.
    Then, this non-static Array and this non-static List cannot be accessed in the public static void main(String[] arg) method.
    What should I do?
    Here is my code that works without problem (the one I do not access the 'titleArray' in the main(String[] arg) method):
    import java.util.Iterator;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Date;
    import java.awt.Color;
    import com.aspose.words.*;
    public class OplanPhase
         public static void main( String[] args)
              OplanPhase root = new OplanPhase( "", "Oplan 50XX - Phase I" );
              OplanPhase objective1 = new OplanPhase( "OO-3.1", "Destroy enemy conventional ground forces" );
              OplanPhase objective2 = new OplanPhase( "OO-3.2", "Destroy enemy conventional air forces" );          
              OplanPhase objective3 = new OplanPhase( "OO-3.3", "Destroy enemy conventional naval forces" );
              OplanPhase objective4 = new OplanPhase( "OO-3.4", "Influence opposition groups within enemy areas to support friendly forces" );
              OplanPhase effect1 = new OplanPhase( "TgtObj-3.1", "Locate, identify, and destroy key enemy C2 nodes" );
              OplanPhase effect2 = new OplanPhase( "TgtObj-3.2", "Locate, identify, and destroy key enemy C2 nodes" );          
              OplanPhase effect3 = new OplanPhase( "CFSOCC-3.2", "influence enemy opposition groups to support friendly forces campaign objectives" );
              OplanPhase effect4 = new OplanPhase( "JFMECC-3.3", "Destroy SLOC interdiction vessels" );
              OplanPhase effect5 = new OplanPhase( "CFSOCC-3.4", "Influence enemy opposition groups to support friendly forces campaign objectives" );     
              OplanPhase moe1 = new OplanPhase( "MOE-TO-3.1", "Conduct surveillance to locate and identify key enemy C2 nodes" );
              OplanPhase moe2 = new OplanPhase( "MOE-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
              OplanPhase moe3 = new OplanPhase( "MOE-JFSOC-3.2", "Number of combined missions successfully completed with opposition groups" );
              OplanPhase moe4 = new OplanPhase( "MOE-JFSOC-3.3", "Number of combined missions successfully completed with opposition groups" );
              OplanPhase task1 = new OplanPhase( "TASK-TO-3.1", "Destroy key enemy C2 nodes" );
              OplanPhase task2 = new OplanPhase( "TASK-TO-3.2", "Conduct surveillance to locate and identify key enemy C2 nodes" );
              OplanPhase task3 = new OplanPhase( "TASK-TO-3.3", "Destroy key enemy C2 nodes" );
              OplanPhase task4 = new OplanPhase( "TASK-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
              root.addSubLevel( objective1 );
              root.addSubLevel( objective2 );
              root.addSubLevel( objective3 );
              root.addSubLevel( objective4 );
              objective1.addSubLevel( effect1 );
              objective2.addSubLevel( effect2 );
              objective2.addSubLevel( effect3 );
              objective3.addSubLevel( effect4 );
              objective4.addSubLevel( effect5 );
              effect1.addSubLevel( moe1 );
              effect1.addSubLevel( task1 );
              effect2.addSubLevel( task2 );
              effect2.addSubLevel( task3 );
              effect3.addSubLevel( moe2 );
              effect3.addSubLevel( moe3 );
              effect5.addSubLevel( task4 );
              effect5.addSubLevel( moe4 );
              root.outputAllWithIndentation( 0 );
         private String[] titleArray = { "", "", "" };
         private int indentation = 0;
         private List<OplanPhase> subLevels = new ArrayList<OplanPhase>();
         private List recursiveTextArray = new ArrayList();
         public OplanPhase( String foo, String bar )
              titleArray[1] = foo;
              titleArray[2] = bar;
         public void addSubLevel( OplanPhase op )
              subLevels.add( op );
         public void outputAllWithIndentation( int level )
              indentation = level;
              titleArray[0] = indentString( indentation );
             System.out.println( titleArray[0] + "[" + titleArray[1] + "] " + titleArray[2] );
             recursiveTextArray.add( titleArray );
              for ( int i = 0; i < subLevels.size(); i++ )
                   ( ( OplanPhase )subLevels.get( i ) ).outputAllWithIndentation( level + 1 );
         private static String indentString( int count )
              String blank = "";
              for ( int i = 0; i < count; i++ )
                   blank = blank.concat( "   " );
              return blank;
    }And the code below gives me the static and non-static problem:
    import java.util.Iterator;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Date;
    import java.awt.Color;
    import com.aspose.words.*;
    public class OplanPhase
         public static void main( String[] args)
              OplanPhase root = new OplanPhase( "", "Oplan 50XX - Phase I" );
              OplanPhase objective1 = new OplanPhase( "OO-3.1", "Destroy enemy conventional ground forces" );
              OplanPhase objective2 = new OplanPhase( "OO-3.2", "Destroy enemy conventional air forces" );          
              OplanPhase objective3 = new OplanPhase( "OO-3.3", "Destroy enemy conventional naval forces" );
              OplanPhase objective4 = new OplanPhase( "OO-3.4", "Influence opposition groups within enemy areas to support friendly forces" );
              OplanPhase effect1 = new OplanPhase( "TgtObj-3.1", "Locate, identify, and destroy key enemy C2 nodes" );
              OplanPhase effect2 = new OplanPhase( "TgtObj-3.2", "Locate, identify, and destroy key enemy C2 nodes" );          
              OplanPhase effect3 = new OplanPhase( "CFSOCC-3.2", "influence enemy opposition groups to support friendly forces campaign objectives" );
              OplanPhase effect4 = new OplanPhase( "JFMECC-3.3", "Destroy SLOC interdiction vessels" );
              OplanPhase effect5 = new OplanPhase( "CFSOCC-3.4", "Influence enemy opposition groups to support friendly forces campaign objectives" );     
              OplanPhase moe1 = new OplanPhase( "MOE-TO-3.1", "Conduct surveillance to locate and identify key enemy C2 nodes" );
              OplanPhase moe2 = new OplanPhase( "MOE-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
              OplanPhase moe3 = new OplanPhase( "MOE-JFSOC-3.2", "Number of combined missions successfully completed with opposition groups" );
              OplanPhase moe4 = new OplanPhase( "MOE-JFSOC-3.3", "Number of combined missions successfully completed with opposition groups" );
              OplanPhase task1 = new OplanPhase( "TASK-TO-3.1", "Destroy key enemy C2 nodes" );
              OplanPhase task2 = new OplanPhase( "TASK-TO-3.2", "Conduct surveillance to locate and identify key enemy C2 nodes" );
              OplanPhase task3 = new OplanPhase( "TASK-TO-3.3", "Destroy key enemy C2 nodes" );
              OplanPhase task4 = new OplanPhase( "TASK-JFSOC-3.1", "Degree of cooperative effort with area opposition groups" );
              root.addSubLevel( objective1 );
              root.addSubLevel( objective2 );
              root.addSubLevel( objective3 );
              root.addSubLevel( objective4 );
              objective1.addSubLevel( effect1 );
              objective2.addSubLevel( effect2 );
              objective2.addSubLevel( effect3 );
              objective3.addSubLevel( effect4 );
              objective4.addSubLevel( effect5 );
              effect1.addSubLevel( moe1 );
              effect1.addSubLevel( task1 );
              effect2.addSubLevel( task2 );
              effect2.addSubLevel( task3 );
              effect3.addSubLevel( moe2 );
              effect3.addSubLevel( moe3 );
              effect5.addSubLevel( task4 );
              effect5.addSubLevel( moe4 );
              root.outputAllWithIndentation( 0 );
              try
                  Iterator it = recursiveTextArray.iterator(); //compilation error
                  while ( it.hasNext() )
                       for ( int i=0; i<titleArray.length; i++ ) //compilation error
                            if ( i == 0 )
                                 System.out.println( titleArray[0] ); //compilation error
                            } else if ( i == 1 )
                                 System.out.println( "[" + titleArray[1] + "] " ); //compilation error                             
                            } else if ( i == 2 )
                                 System.out.println( titleArray[2] ); //compilation error
              } catch (Exception e)
                   // TODO Auto-generated catch block
                   e.printStackTrace();
         private String[] titleArray = { "", "", "" };
         private int indentation = 0;
         private List<OplanPhase> subLevels = new ArrayList<OplanPhase>();
         private List recursiveTextArray = new ArrayList();
         public OplanPhase( String foo, String bar )
              titleArray[1] = foo;
              titleArray[2] = bar;
         public void addSubLevel( OplanPhase op )
              subLevels.add( op );
         public void outputAllWithIndentation( int level )
              indentation = level;
              titleArray[0] = indentString( indentation );
             System.out.println( titleArray[0] + "[" + titleArray[1] + "] " + titleArray[2] );
             recursiveTextArray.add( titleArray );
              for ( int i = 0; i < subLevels.size(); i++ )
                   ( ( OplanPhase )subLevels.get( i ) ).outputAllWithIndentation( level + 1 );
         private static String indentString( int count )
              String blank = "";
              for ( int i = 0; i < count; i++ )
                   blank = blank.concat( "   " );
              return blank;
    }

    What should I do?If you feel you need to cross-post, you should have the courtesy to provide a
    link to the other post/s.
    http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=1&t=016129

  • How to run sequential commands by runtime or whatever in java?

    I'm doing a compile function in java GUI and need to run several commands one by one, how can i do this and how can i know that the previous command has been done and finished?
    commands like
    make ....
    make ....
    make ....
    then do
    ./run.x ....
    thanks a lot!

    THe Process object that Runtime.exec method returns has a method called waitFor. Calling it makes the currently executing Java thread wait for the process to exit.
    (apidoc: http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html#waitFor())

Maybe you are looking for