Home How to automatically answer user prompts in Java?
Reply: 0

How to automatically answer user prompts in Java?

user1123
1#
user1123 Published in April 26, 2018, 5:45 am

I'm using a compiled Java file which takes a filename as a parameter and then asks for a username and password (via user input). I am trying to automate this from a shell script, but am running into problems. I'm unable to access the java code, which is why I am having trouble.
So the code is called the following way

java javaprogram /home/user/securityfile

So, you pass the file, and then it asks you for username and password. After entering those, it's done.

Now, I have tried to put the user input into a file and pass it in, but I get an error.

java javaprogram /home/user/securityfile < userinputfile

userinput file contains the following text (First line is the username, second line is the password):

MattSmith
MSpassword136

Does anyone have any ideas? Maybe I am doing it wrong?

Here is the error message:

Exception in thread "main" java.lang.NullPointerException at ilex.util.UserAuthFile.main(UserAuthFile.java:297) 

Thanks

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.345134 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO