The shell can operate in one of 3 modes -

        Mode 0 - Run command, waiting until the command completes to return

        Mode 1 - Run the command asynchronously, but don't accept input

        Mode 2 - Run the command in interactive mode

It sounds like you need the command to run in Mode 2 because you're doing more than simply executing a command.

        Dim i_jErr As Integer
        Dim s_jResult As String
        Dim sh_MyJavaShell As New Shell

        sh_MyJavaShell.Mode = 0
        sh_MyJavaShell.timeout = -1

        // Start a cmd shell and send the commands in WriteLine calls
        sh_MyJavaShell.Execute "cmd.exe"
        sh_MyJavaShell.WriteLine "cd '/Path to/my Directory'"
sh_MyJavaShell.WriteLine "java -cp MyClasses.jar path.to.MyClass arg1 arg2"
        sh_MyJavaShell.WriteLine "exit"

        // Loop until the task finishes
        Do
                App.DoEvents(20)
        Loop Until Not sh_MyJavaShell.IsRunning

        // grab the results and use them as needed
        i_jErr = sh_MyJavaShell.ErrorCode
        s_jResult = sh_MyJavaShell.ReadAll

Granted, that's from off the top of my head, but it should get you pointed in the right direction.

Does that help? There are also some shell examples in the Examples folder on the RB distribution.

Tim
--
Tim Jones
[EMAIL PROTECTED]

On Jan 13, 2007, at 2:03 PM, Mark Lubratt wrote:

Hello!

Well, I've been trying to avoid this as long as possible, but I can't seem to find a working alternative. I need to execute the following commands within a shell:

cd /Path to/my Directory

java -cp MyClasses.jar path.to.MyClass arg1 arg2

Upon the completion of the java command, the shell can terminate/go to sleep/go out of context/whatever.

How do I do this with in the RB shell class? I've read over the LR and the shell examples; but, I can't seem to get a program to successfully execute this. I'm confused.

What mode should the shell be in?
Do I use .execute, or .writeline?
Do I have to do .execute("sh") first?

I'm using RB2007r1 on WinXP Home.

Thanks!  Any help is greatly appreciated!
Mark

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to