我有其中i已禁用用於密碼字段呼應擊中以下命令後的應用程序:掩蔽密碼輸入從控制檯:爪哇與nohup命令
java -cp testJar.jar testClassFileInJar username
其中用戶名是提供給主參數類testClassFileInJar的方法。點擊回車後,系統會提示輸入密碼。當我嘗試下面的命令我不能讓它運行,並且java1.out文件也是空的。
nohup java -cp testJar.jar testClassFileInJar username & > java1.out
請建議。總而言之,我需要在java1.out文件中執行日誌記錄,並使用nohup命令來使用此java命令。
我用的主要方法如下代碼:
Console console = System.console();
String userName = args[0];
String password = String.valueOf(console.readPassword("Password: "));
//other code logic for processing username and password
我試了一下。它不工作:( – Arun