Reputation: 115
I have a shell script and argument as a date. I'm looking for some help in design, where I will have to create a UI and pass the date, so that it will call the shell script with an argument (it should open unix terminal and call the shell script with username and password). The whole shell script runs on LINUX server. I would preferably be on MarkLogic/Java/Unix and Scala. I should not use web server in my application.
Can someone please suggest how to call the shell script from Java application with out using an Appserver/Webserver.
Upvotes: 1
Views: 1061
Reputation: 7770
I find your actual question quite confusing and even more so after your clarification to nhouser9.
What I interpret is :
1) You need a user interface (but not a terminal?)
- Your simple need may be addressed with the tried and true old timer Java Abstract Windows Toolkit (AWT). Have a look at the wikipedia page: https://en.wikipedia.org/wiki/Abstract_Window_Toolkit
The sample code there compiles into a very simple Hello World GUI. (Java package info here: https://docs.oracle.com/javase/8/docs/api/java/awt/package-summary.html)
2) You need to call a shell script from Java: Then for this part of the question, have a look at nhouser9's original comment. That answer can be found here: calling-shell-script-from-java The heart of this is ProcessBuilder
Add 1 and 2 together and you can create a GUI to take a parameter and then execute a shell script.
Upvotes: 2