The console below is always null, where would be the problem? Only when I am in eclipse, I can run the application properly with java MainDocument
Code:
import java.io.Console;
import java.sql.SQLException;
public class MainDocument {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Console console = System.console();
if (console == null) {
System.err.println("sales: unable to obtain console");
return;
}
console.printf("%s ", "string");
}
}
result=> sales: unable to obtain console
I have set the path X:\Sun\sdk\jdk\bin to no avail.
I guess there is something wrong with classpath or whatsoever... but not sure how to setup.... could anyone help me out?
Any suggestions?
Jack