System.consoel()

hi,i installed java 1.6 from sun site. when i tried System.console() method, it always returns null only. just now i installed the java 1.6.Is it available in that one or not. if available how to use that. plz reply for this.
[239 byte] By [sampath.reddya] at [2007-11-26 12:54:10]
# 1

Hi,

Yes that version has the method, but the javadoc for console says this:

" Whether a virtual machine has a console is dependent upon the underlying platform and also upon the manner in which the virtual machine is invoked. If the virtual machine is started from an interactive command line without redirecting the standard input and output streams then its console will exist and will typically be connected to the keyboard and display from which the virtual machine was launched. If the virtual machine is started automatically, for example by a background job scheduler, then it will typically not have a console."

So it depends on how you start your application, and of what type it is.

Kaj

kajbja at 2007-7-7 16:45:45 > top of Java-index,Java Essentials,Java Programming...
# 2
this might help http://www.javalobby.org/java/forums/t84689.html
G_Abubakra at 2007-7-7 16:45:45 > top of Java-index,Java Essentials,Java Programming...
# 3
Hi,If System.console returns NULL, then Console operations are not permitted, either because the OS doesn't support them or because the program was launched in a noninteractive environment.Babu.
ksbabua at 2007-7-7 16:45:45 > top of Java-index,Java Essentials,Java Programming...