hello, I have a java program which connects to a unix account and needs to run 
some local scripts, the code looks like this:
        RLoginClient connection=new RLoginClient();
        String lUser=System.getProperty("user.name"),lHost;
        try {
            lHost=InetAddress.getLocalHost().getHostName();
            RExecClient rExecClient=new RExecClient();
            rExecClient.connect(this.mHost);
            rExecClient.rexec(this.mUser,this.mPasswd,"if [ -f 
"+'"'+".rhosts"+'"'+" ]; then cp .rhosts .rhosts.bak; fi; echo "+'\"'+lHost+" 
"+lUser+"\n"+lHost+".amdocs.com "+lUser+"\n"+lHost+".corp.amdocs.com 
"+lUser+'"'+" >> ~/.rhosts");
            rExecClient.disconnect();
            connection.connect(this.mHost);
            connection.rlogin(lUser,this.mUser,"xterm");
        }
        catch (SocketException e) {
            ...
        }
        catch (IOException e) {
            try {
                connection.disconnect();
            }
            catch (IOException f) {
            ...
        }
        OutputStreamWriter virtualKeyboard=new 
OutputStreamWriter(connection.getOutputStream());
        InputStreamReader virtualScreen=new 
InputStreamReader(connection.getInputStream());
        try {
            virtualKeyboard.write("if [ ! -d installer ]; then mkdir installer; 
chmod 755 installer; fi;".toCharArray());
            virtualKeyboard.flush();

the first rexec works and the command gets executed, but the two last lines get 
executed but on the unix side, I cannot see the output e.g. the folder, copying 
the line as is and running it in unix works.
this leads me to believe that the buffer doesn't get flushed.
how can I fix this?
I'm using latest jars from site and java 1.6 update 14.

thanks.


 
: "    ,               ".


An wise Scandinavian old man once said: "in the end, everything is going to be 
alright"



      

Reply via email to