I have an application where i have disabled the echoing for the password field after hitting the following command:
java -cp testJar.jar testClassFileInJar username
where username is a parameter provided to the main method of the class testClassFileInJar. After hitting enter, password is prompted. When i try the following command i could not make it run and the java1.out file is also empty.
nohup java -cp testJar.jar testClassFileInJar username & > java1.out
Please suggest. To summarize, I need logging to be done in java1.out file and nohup command to be used with this java command.
I have used the following code in main method:
Console console = System.console();
String userName = args[0];
String password = String.valueOf(console.readPassword("Password: "));
//other code logic for processing username and password
I tried with nohup but nothing worked. I then configured logger to the application(
java.util.logging.Logger) and usedscreento run the following command.In screen this command will prompt for the password.
Simply satisfied my requirement 🙂