Dear Raghuram Devarakonda,

 looks the error comes from the Java Runtime class. The Windows "date"
command initiates a console dialog, maybe this is the cause of the bug.
If  I change the command to another valid statement, like for example  
"ping 127.0.0.1", the native console interface works normally with no
error display.  This test did run under Windows XP.  

Regards,
Claude

C:\Jython\myprojects\testing>jython nativeos.py
Traceback (innermost last):
  File "nativeos.py", line 5, in ?
java.io.IOException: CreateProcess: date /t error=2

Sample code nativeos.py:

from java.lang import Runtime
from java.io import BufferedReader
from java.io import InputStreamReader

p = Runtime.getRuntime().exec("date /t")    
stdInput = BufferedReader(InputStreamReader(p.getInputStream()))
stdError = BufferedReader(InputStreamReader(p.getErrorStream()))

print "Here is the standard output of the command:\n"
s = ' '
while (s != None):
    s = stdInput.readLine()
    if (s is None):
        print ''
    else:    
        print s  

print "Here is the standard error of the command (if any):\n"
s = ' '
while (s != None):
    s = stdError.readLine()
    if (s is None):
        print ''
    else:    
        print s  

Raghuram Devarakonda wrote:

Thanks for the info but my intention is not to get the date. I just used
it as a simple means to show the issue.

Thanks,
Raghu.

claudef@br.ibm.com wrote:
>
> Dear Raghuram Devarakonda,
>
>  looks like the core question is about how to get the system time and
> date from a native OS, like Windows 2003.
>
>  Java itself provide some rich and handy classes (since Java 5)
> which helps to format the date and time output using a given pattern.
>
>  The new SimpleDateFormat class comes with the java.text library.
> Using Java in place of native OS calls results in better portability.  
> To avoid ambiguity with similar Python or SQL classes, I use to
> rename the Date class (see a sample code below):  
>  
> from java.util import Date as javaDate
> from java.text import SimpleDateFormat
> # defining date and time output pattern
> formatter_date = SimpleDateFormat("dd/MM/yyyy")
> formatter_time = SimpleDateFormat("HH:mm:ss")
> mytoday = javaDate()
> formattedtoday_date = formatter_date.format(mytoday)
> formatted_time = formatter_time.format(mytoday)
> print("my sample clock shows: " + formattedtoday_date + " " +
> formatted_time)